Comments (1)
Pyright is working as intended here, so this isn't a bug. See #6113.
You can use ==
or is
, but you can't use a truthy/falsy check if you want pyright to narrow the type in this case.
from pyright.
Related Issues (20)
- reportUnusedFunction triggers for inner functions which are captured by decorators HOT 1
- Parameter erroneously marked as unused HOT 2
- NotImplemented is incompatible with None HOT 1
- How to include files with custom extensions? HOT 2
- Generator lambda breaks its preceding function HOT 1
- Type annotation on global mutable variable is ignored HOT 5
- Type incompatibility when using a generic callback protocol HOT 2
- 'Argument of type "bool" cannot be assigned to parameter "X"' when passing kwargs to Django model HOT 1
- Spurious error when using closed `TypedDict` with `__extra_items__` HOT 1
- `random.choice` and list of enums produces inconsistent `None` type narrowing HOT 1
- Infinite loop (and OOM later) with datetype library HOT 1
- Type of `typing.Any` should be `typing._AnyMeta`, not `typing.Any` HOT 1
- `builtins.print` and `builtins.input` are not instances of `types.BuiltinFunctionType`? HOT 1
- `reportMissingTypeStubs` default value is incorrect in some places HOT 2
- Pyright hanging with unannotated script HOT 2
- [match-case] Object of type "Callable" is not callable HOT 2
- Dutch Localization for pyright HOT 3
- No error on reassigning Final vars in class bodies HOT 4
- returning an enum variant from a classmethod returning `Self` produces an error. HOT 4
- Parse error with backslash before indented block HOT 1
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 pyright.