Comments (2)
Your evaluation is incorrect - we don't report here because we assume TS is better than it is.
The rule is powered purely by the types that TS reports.
If you inspect the types of prop
with and without the assertion you can see that without the assertion TS reports the type of prop
to be T extends "y" | "x"
but with the assertion instead TS reports the type of prop
as "y"
.
I think that this is a bug with TS itself - a behaviour that changed in (from the looks of it based on testing) in TS v4.3. In v4.2 TS correctly reports both locations as the generic - in v4.3+ it exhibits the above behaviour.
The assertion should not be changing the type of the original variable.
from typescript-eslint.
thanks @bradzacher yup I can see the behaviour change in TS v4.3. I will lodge a bug report with them.
from typescript-eslint.
Related Issues (20)
- Bug: [explicit-function-return-type] false positive when returning an object with a typed function property HOT 2
- Rule proposal: break up consistent-type-assertions into consistent-type-assertion-syntax and no-unsafe-object-literal-type-assertion HOT 4
- Enhancement: ban wide globs in `parserOptions.useProjectService.allowDefaultProjectForFiles` HOT 1
- Bug: Error while loading rule '@typescript-eslint/await-thenable' HOT 1
- Docs: Separate FAQs into discrete sections
- Enhancement: Remove AST properties deprecated in v6
- Enhancement: Remove deprecated emitDecoratorMetadata
- Enhancement: Raise minimum versions of dependencies for v8 HOT 8
- Enhancement: Remove deprecated getTypeArguments from type-utils HOT 1
- Enhancement: Remove IsNullableTypeOptions from type-utils HOT 1
- Bug: [prefer-readonly-parameter-types] Doesn't work on `DeepReadonly` from `ts-essentials`, `utility-types`, and `type-fest` HOT 7
- Repo: Ideas for avoiding drift between a renamed rule and the original HOT 5
- Rule proposal: "no-any?" to disallow `any` in function parameters with type annotation HOT 2
- Rule proposal: prefer-structured-clone HOT 3
- Repo: handle exceptions that occur while testing a rule better HOT 2
- Configs: Please add consistent-type-imports and consistent-type-exports for stylistic-type-checked HOT 1
- Docs: jot down comon patterns for rule development HOT 1
- Bug: [unbound-method] Does not fail for destructured parameters HOT 3
- Repo: Set up v8 alpha/canary version publishing
- Bug: [explicit-function-return-type] false positive on defaulting parameters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-eslint.