Typescript error - Type 'Name' does not satisfy the constraint 'string'
See original GitHub issueI’m seeing the following Typescript error:
ERROR in [at-loader] ./node_modules/jss/src/index.d.ts:8:78
TS2344: Type 'Name' does not satisfy the constraint 'string'.
Type 'string | number | symbol' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
…which I’m circumventing by amending ./node_modules/jss/src/index.d.ts
to look like this:
export type Classes<Name extends string = string> = Record<Name, string>
Er, I think that’s an issue with jss
, but I’m willing to be told otherwise 😉
I’m running typescript v3.6.3, node v10.15.3 and npm v6.11.2 on different OS’s.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Type 'T' does not satisfy the constraint 'string | number | symbol ...
I have the following code, and I receive the following error. Type 'T' does not satisfy the ...
Read more >Why is my Pick<> failing with "Type does not satisfy ... - Reddit
I have a file called ionIcons.ts. It contains a list of var delcarations. export declare var accessibility: string; export declare var…
Read more >Incorrect, "Type does not satisfy the constraint" error when ...
The following code is in fact valid, compiles and runs fine, and is without error in the TypeScript Playground. However, when R# is...
Read more >Type Argument Constraints - Advanced TypeScript Masterclass
The reason for this error is that the T type argument of the function has no restrictions. You're trying to pass it to...
Read more >TypeScript: Type 'T' does not satisfy the constraint '(...args: any ...
This is in fact how the type parameters of the language provided utility types Parameters<T> and ReturnType<T> are specified thus causing the error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bassettb if you are still having this error or anybody else in the future, I found some documentation about the “keyOfStringsOnly” in the tsconfig file. When I removed that setting, it compiled.
@sikorsky555 you sir, are an absolute star! I will admit to hacking out
Name extends string | number | symbol = string
for the best part of two years! Now I can move on with the rest of my life (well, if I wasn’t stuck at home on lockdown)! 😃