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

Formatting error with single quotes inside a string literal type #61

Closed
michaelstephendavies opened this issue May 17, 2023 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@michaelstephendavies
Copy link

michaelstephendavies commented May 17, 2023

Describe the bug
Hovering over the error in:

const x: "' 'Oh no" = null;

The formatting is broken

Type null is not assignable to type "'Oh no"'.

Expected behavior

Type null is not assignable to type "' 'Oh no".

Original error
Type 'null' is not assignable to type '"' 'Oh no"'.ts(2322)

Screenshots
image

@michaelstephendavies michaelstephendavies added the bug Something isn't working label May 17, 2023
@BalthazarB
Copy link

I would like to fix this bug

@yoavbls
Copy link
Owner

yoavbls commented Jun 20, 2023

@BalthazarB you're welcome to do it 🙂

@yoavbls yoavbls added the help wanted Extra attention is needed label Jul 29, 2023
@MikeJakuszewski
Copy link

Is this still open?

@yoavbls
Copy link
Owner

yoavbls commented Sep 11, 2023

@MikeJakuszewski yes

@MikeJakuszewski
Copy link

@yoavbls, what is the expected behavior we want? Do we want to remove the inner quotes? I think I found the error, it is under format/addMissingParentheses.ts

@yoavbls
Copy link
Owner

yoavbls commented Sep 16, 2023

@MikeJakuszewski The expected behavior is without removing the inner quotes:
type null is not assignable to type "' 'Oh no"

You're welcome to try to fix it, and I can help in Discord if needed
Unfortunately, I don't think it's the addMissingParentheses function because it should called only when a type ends with ...

@yoavbls
Copy link
Owner

yoavbls commented Sep 18, 2023

I'm pretty sure I fixed all the cases of string literal types that did not escape properly here.

Give it a try with 0.5.2 and reopen this issue if you find new cases like this

@yoavbls yoavbls closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants