ts-interface-checker
ts-interface-checker copied to clipboard
Exporting default interface parses into incorrect interface name
Typescript now allows the default
keyword to be used when exporting an interface, for example
export default interface DataModelConfig {
currentScore: number,
progress: number[] | null
}
However, the current command npx ts-interface-builder path/to/file.ts
will produce files with the interface named as default
.
/**
* This module was automatically generated by `ts-interface-builder`
*/
import * as t from "ts-interface-checker";
// tslint:disable:object-literal-key-quotes
export const default = t.iface([], {
"currentScore": "number",
"progress": t.union(t.array("number"), "null"),
});
const exportedTypeSuite: t.ITypeSuite = {
default,
};
export default exportedTypeSuite;
This can't be used because default
is a reserved keyword. There might be some parsing issue with the interface names when default
is specified.