Comments (2)
This is the correct behavior. It's possible to observe blah
before the if
, e.g.:
// self-import in foo.mjs
import { blah as self_blah } from "./foo.mjs";
let blah;
// prints "undefined"
console.log(self_blah);
if (!blah) throw new Error('This error does not narrow type')
export {
blah
}
from typescript.
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes.
from typescript.
Related Issues (20)
- JavaScript class decorators returning extended class that implements the target but types can't match the constraints HOT 3
- [RFC] Code Prompts, a Prompt Format for AI-Powered Code Auto-Completion HOT 7
- Missing the `AbortSignal.any()` function
- Debug Failure. Did not expect ObjectLiteralExpression to have an Identifier in its trivia HOT 7
- Proposal - Module Interface HOT 6
- Uncaught Error: Debug Failure. at getThisContainer (while executing getCompletionsAtPosition n JavaScript file) HOT 1
- Support `satisfies` as a constraint on a function's generic type parameter HOT 22
- Type unexpectedly not narrowed after check
- Optional chaining for arrays inferring wrong type HOT 3
- TypeScript 5.4 import path completion results in unintended paths HOT 4
- Inconsistent Behavior with `readonly` in Template Literal Indexed Access Types HOT 3
- Design Meeting Notes, 4/2/2024
- Error: Debug Failure. False expression: Expected the specifier to be a default export HOT 1
- type assertions affect the type narrowing of the subsequent code HOT 6
- Missing interface definition for Highlight API HOT 1
- Improve new issue template selection - reorder and handle "this is crash" check better HOT 3
- Union type breaks type safety of dynamic object keys HOT 2
- Asserting changes type of original variable inline (the change reverts in subsequent lines) HOT 10
- "declare class" in a global is not visible in external files HOT 7
- Mapped type reported as incompatible when passed through another mapped type (5.4 regression) 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 typescript.