-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[restrict-template-expressions] Missing handling of intersection type #1797
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
Comments
Happy to accept a PR! |
Yes that's correct, but this pattern (add a "fake" disciminator/tag prop) is nice to "type" primitives (forbid assignability between |
yeah, I use this within the parser here to help distinguish between known-canonicalized paths, and other paths. It would be a good change to make, we should probably create some utilities for this, because this will effect many of our rules. It's not a "common" pattern, so it's not been a problem for most users. |
intersection types (fixes typescript-eslint#1797)
…ntersection types (fixes typescript-eslint#1797)
…ntersection types (fixes typescript-eslint#1797)
…intersection types (fixes typescript-eslint#1797)
Repro
Expected Result
No error.
Actual Result
"Invalid type of template literal expression"
Additional Info
Real-world example:
See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/638a579eecfa0486115f2440518603f25a8b58b7/types/sparqljs/index.d.ts#L223.
Versions
@typescript-eslint/eslint-plugin
2.25.0
@typescript-eslint/parser
2.25.0
Proposed solution
Don't emit an error if any item of the intersection type is "allowed" in respect to the options.
The text was updated successfully, but these errors were encountered: