Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting default interface parses into incorrect interface name #72

Open
rui-han-crh opened this issue Jul 23, 2023 · 0 comments
Open

Comments

@rui-han-crh
Copy link

rui-han-crh commented Jul 23, 2023

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.

@rui-han-crh rui-han-crh changed the title Exporting default interface parsing into incorrect interface name Exporting default interface parses into incorrect interface name Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant