We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 version 4.6.2 VSCode version 1.65.0
#202 #25642
1 type Foo = String & { bar: 'baz' } 2 3 function qux(quux: Foo) { 4 const quuz = ''; 5 quux === quuz; 6 } 7 8 qux('');
Line 5: This condition will always return 'false' since the types 'string' and 'Foo' have no overlap.
This condition will always return 'false' since the types 'string' and 'Foo' have no overlap.
No compiler error
The text was updated successfully, but these errors were encountered:
String is a wrapper type of string, and in general String ≠ string, because typeof new String("foo") === "object" while typeof "foo" === "string".
String
string
typeof new String("foo") === "object"
typeof "foo" === "string"
FYI, there's the TS-ESLint rule ban-types that bans the String type because of this confusion.
ban-types
Sorry, something went wrong.
Wow. Thanks for the quick response! That did it.
No branches or pull requests
Bug Report
Typescript version 4.6.2
VSCode version 1.65.0
🔎 Search Terms
#202
#25642
💻 Code
🙁 Actual behavior
Line 5:
This condition will always return 'false' since the types 'string' and 'Foo' have no overlap.
🙂 Expected behavior
No compiler error
The text was updated successfully, but these errors were encountered: