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

TypeScript App/Plugin Codegen Types Aren't Very Type-Safe #897

Closed
dOrgJelli opened this issue Jun 3, 2022 · 0 comments · Fixed by #1217
Closed

TypeScript App/Plugin Codegen Types Aren't Very Type-Safe #897

dOrgJelli opened this issue Jun 3, 2022 · 0 comments · Fixed by #1217
Assignees
Milestone

Comments

@dOrgJelli
Copy link
Contributor

Currently, most-all interface types for TypeScript applications are like so:

interface ModuleMethodInput extends Record<string, unknown> {
  argument?: Types.String | null;
}

export const Module = {
  method: async (
    input: ModuleMethodInput,
    client: Client
  ): Promise<InvokeApiResult<...>> => {
    ...
  }
}

The problem is that our input types extend from Record<string, unknown>, which is a generic property-map. This means that code like this will still compile, when it shouldn't:

Module.method({ foo: "value" });
// ^ "foo" should be "argument"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants