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

Template not compiling with TS 2.9 #5

Closed
macstr1k3r opened this issue Jul 31, 2018 · 2 comments
Closed

Template not compiling with TS 2.9 #5

macstr1k3r opened this issue Jul 31, 2018 · 2 comments

Comments

@macstr1k3r
Copy link

When trying to use this module with Typescript 2.9 the following error pops up.

dare@mbp ~/dev/ecs-ms (master *)]$ npm i typescript@2.9

+ typescript@2.9.2
updated 1 package and audited 4 packages in 2.607s
found 0 vulnerabilities

[dare@mbp ~/dev/ecs-ms (master *)]$ ./node_modules/.bin/tsc -p .
node_modules/cloudformation-declarations/src/declarations/core.ts:7:55 - error TS2344: Type 'keyof T' does not satisfy the constraint 'string'.
  Type 'string | number | symbol' is not assignable to type 'string'.
    Type 'number' is not assignable to type 'string'.

7 export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
                                                        ~~~~~~~

@macstr1k3r
Copy link
Author

macstr1k3r commented Jul 31, 2018

This comes from the change introduced in TS 2.9 https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html

  • An index type keyof T for some type T is a subtype of string | number | symbol.

a workaround is to use the --keyofStringsOnly compiler flag

@cspotcode
Copy link
Owner

Thanks for reporting this. We can also switch to using a StringKeyOf<T> generic.

type StringKeyOf<T> = Extract<keyof T, string>;

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

2 participants