question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript error - Type 'Name' does not satisfy the constraint 'string'

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
sikorsky555commented, Feb 6, 2020

@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.

1reaction
glowkeepercommented, May 9, 2020

@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)! 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found