typescript-json-schema
typescript-json-schema copied to clipboard
Error when use "[key: `data-${string}`]: string;"
Case:
export interface ComponentProps {
/**
* @TJS-ignore
*/
[key: `data-${string}`]: string;
}
Error:
Error: error: Error: Not supported: IndexSignatureDeclaration with index symbol other than a number or a string
https://github.com/ant-design/ant-design/blob/master/components/button/button.tsx#L46
What worked for me is changing from
interface Config {
[key: `data-${string}`]: string;
}
to
type Config = Record<`data-${string}`, string>