victory
victory copied to clipboard
Ts build fail TS1110: Type expected.
Describe the bug A clear and concise description of what the bug is.
/Users/bafan/tuya/doberman-front/node_modules/victory-core/lib/victory-util/events.d.ts(9,42) TS1110: Type expected.
the code is
export declare type ComponentEventName = `on${Capitalize<string>}`;
Victory version Which npm version are you using? 6.14.7 typescript 3.8.3
TypeScript 4.1 introduced these Template Literal Types ... so this issue appears to be due to the older TypeScript version being used.
That being said, I'll investigate how often we use this syntax, and see if we could drop it, to increase TS compatibility.
@gksander We currently use "Template Literal Types" syntax in 2 places: [ComponentEventName] and [SafeAttribute]. Neither is too critical, and only provides a tiny-bit of type safety, so what do you think about replacing these types with string
, in order to improve TS compatibility with <4.1?
That sounds reasonable to me. I wonder if there's any way to fork a type based on TS version it's being used on 🤔 I'm not aware of any mechanism, but it certainly would be nice to use template literals and then TS just fallback to strings on TS <4.1.
Fixed in 36.6.1
👍