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

Incorrect printing of literal types #694

Open
dgreensp opened this issue Jan 27, 2025 · 0 comments
Open

Incorrect printing of literal types #694

dgreensp opened this issue Jan 27, 2025 · 0 comments

Comments

@dgreensp
Copy link

dgreensp commented Jan 27, 2025

Bit ints

This code:

export type Falsy = false | "" | 0 | 0n | null | undefined;

incorrectly prints as:

type Falsy = false | "" | 0 | 0 | null | undefined

A big int 0 should print (I think) as 0n. TypeScript distinguishes between the types 0 and 0n. 0 | 0 will simplify to 0, while 0 | 0n will not.

Strings

It seems that no escaping is performed on string literal types. This code:

export type Newline = "\n";

prints (in command-line text output) as:

type Newline = "
"
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

1 participant