-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Milestone
Description
TypeScript Version: 2.0.2 rc
This is a regression from 2.0.0 beta
Code
First, I define some types in file1.ts:
export interface Route<P> {
uri: string
}
export interface RouteWithParams<P> {
route: Route<P>
isIn<T>(parent: Route<T>): this is RouteWithParams<T>
}Then, I re-export these types from another module, for convenience (one is an abstract util module used only once, the other should be exclusively imported everywhere):
file2.ts
import { Route, RouteWithParams } from './file1'
export { Route, RouteWithParams }Then, whenever I import these types in other modules, they are seen as having the never type (error TS2339: Property 'isIn' does not exist on type 'never').
I hope I have isolated the issue. It could also be due to wrong flow analysis.
If not, you can also very easily see the issue on a repo I have:
git clone [email protected]:AlexGalays/kaiju.git
cd kaiju/example
npm install
npm run build // it compiles fine
Now go to package.json and change the typescript version from `beta` to `rc`
npm install
npm run build // compilation errorMetadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug