Skip to content

{} | unknown is assignable to Uppercase<string> and Co. #52731

@geoffreytools

Description

@geoffreytools

Bug Report

🔎 Search Terms

Intrinsic string manipulation types,Uppercase, Lowercase, Capitalize, Uncapitalize

🕗 Version & Regression Information

Since 4.8.4.
Uppercase<string> use to resolve to string between 4.1.5 and 4.7.4
The behaviour in 4.8.4 is not the same as in 4.9.5 / Nightly

⏯ Playground Link

Playground link with relevant code

💻 Code

type Obj = {} extends Uppercase<string> ? true : false      // true
type Unk = unknown extends Uppercase<string> ? true : false // true

🙁 Actual behavior

The return value is true. It should not be, because intrinsic string manipulation types should resolve to subtypes of string (or string at the very least), and {} or unknown are not assignable to string.

🙂 Expected behavior

I expected the return type to be false.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions