Skip to content

Fix error on extends in declaration file with importHelpers #12775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2016
Merged

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented Dec 8, 2016

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

Copy link
Contributor

@mhegazy mhegazy left a comment

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
Member Author

rbuckton commented Dec 9, 2016

@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.

@mhegazy mhegazy merged commit 24c56a5 into master Dec 13, 2016
@mhegazy mhegazy deleted the fix12724 branch December 13, 2016 00:18
@mhegazy mhegazy mentioned this pull request Dec 13, 2016
@dtabuenc
Copy link

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
Contributor

mhegazy commented Dec 13, 2016

@dtabuenc, have you tried with typescript@next?

@dtabuenc
Copy link

dtabuenc commented Dec 13, 2016

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 free to 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