Skip to content

Fix error on extends in declaration file with importHelpers - #12775

Merged
Mohamed Hegazy (mhegazy) merged 1 commit into
masterfrom
fix12724
Dec 13, 2016
Merged

Fix error on extends in declaration file with importHelpers#12775
Mohamed Hegazy (mhegazy) merged 1 commit into
masterfrom
fix12724

Conversation

@rbuckton

Copy link
Copy Markdown
Contributor

The call to checkExternalEmitHelpers for the __extends helper was incorrectly reporting an error when extends was used in a declaration file with --importHelpers and a missing tslib.d.ts file.

Fixes#12724

@mhegazyMohamed Hegazy (mhegazy) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually i think we should push this check into checkExternalEmitHelpers to avoid having to do this for every helper that may be needed in the future, e.g. ambient decrators, or spread/set in type position.

@rbuckton

Copy link
Copy Markdown
ContributorAuthor

Mohamed Hegazy (@mhegazy) I chose to be explicit about the check as I wanted to avoid walking up the spine to check for an ambient context every time we call this function. extends currently is the only case where this matters.

@dtabuenc

Copy link
Copy Markdown

I'm also seeing this on destructuring in angular2:
node_modules/@angular/core/src/metadata/di.d.ts(178,48): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

The d.ts it's complaining about is:

(selector: Type<any>|Function|string,{descendants, read}?: {descendants?: boolean;read?: any;}): any;new(selector: Type<any>|Function|string,{descendants, read}?: {descendants?: boolean;read?: any;}): Query;

I don't get why it says tslib cannot be found though. A --traceResolution shows that tslib is succesfully resolved from node_modules folder many times.

@mhegazy

Copy link
Copy Markdown
Contributor

Daniel Tabuenca (@dtabuenc), have you tried with typescript@next?

@dtabuenc

Daniel Tabuenca (dtabuenc) commented Dec 13, 2016

Copy link
Copy Markdown

Yeah I tried with with typescript@next installed minutes before I posted.
Version I used was Version 2.2.0-dev.20161213

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rbuckton@dtabuenc@mhegazy@msftclas