Skip to content

Commit

Permalink
Resolve re-exports when looking for tslib helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed May 18, 2023
1 parent 8fae437 commit 18b8b63
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46998,7 +46998,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (requestedExternalEmitHelperNames.has(name)) continue;
requestedExternalEmitHelperNames.add(name);

const symbol = getSymbol(helpersModule.exports!, escapeLeadingUnderscores(name), SymbolFlags.Value);
const symbol = getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), SymbolFlags.Value);
if (!symbol) {
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
}
Expand Down
29 changes: 29 additions & 0 deletions tests/cases/compiler/tslibReExportHelpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @module: nodenext
// @experimentalDecorators: true
// @importHelpers: true

// @Filename: /node_modules/tslib/index.d.ts
export declare function __decorate(...args: any[]): any;

// @Filename: /node_modules/tslib/index.d.mts
export * from "./index.js";

// @Filename: /node_modules/tslib/package.json
{
"name": "tslib",
"version": "1.0.0",
"types": "index.d.ts",
"exports": {
".": {
"types": {
"import": "./index.d.mts",
"default": "./index.d.ts"
}
}
}
}

// @Filename: /index.mts
declare var decorator: any;
@decorator
export class Foo {}

0 comments on commit 18b8b63

Please sign in to comment.