question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

declare module `'tslib'`

See original GitHub issue

Right now, tslib.d.ts does not contain a module declaration for 'tslib’ and instead declares the functions in the global namespace. As of TS 2.1.4, when I enable the --noEmitHelpers and --importHelpers compiler flags, my build fails because it cannot find the required 'tslib' module.

I’m opening an issue because there’s probably a reason this hasn’t been done already, but wouldn’t it be possible to do something like:

// ... existing global typing defs
declare module 'tslib' {
  export function __extends(d: Function, b: Function): void;
  export function __assign(t: any, ...sources: any[]): any;
  export function __rest(t: any, propertyNames: string[]): any;
  export function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
  export function __param(paramIndex: number, decorator: Function): Function;
  export function __metadata(metadataKey: any, metadataValue: any): Function;
  export function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
  export function __generator(thisArg: any, body: Function): any;
}

@billti @rbuckton @sandersn for visibility

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rbucktoncommented, Dec 19, 2016

I think part of the issue is that your "typeRoots" definition is incorrect. The "typeRoots" field should point to folders only, and does not support globs. Please refer to www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types for more information.

0reactions
mhegazycommented, Dec 21, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

declare module `'tslib'` · Issue #16 · microsoft/tslib - GitHub
4, when I enable the --noEmitHelpers and --importHelpers compiler flags, my build fails because it cannot find the required 'tslib' module. I'm ...
Read more >
"This syntax requires an imported helper but module 'tslib ...
In my case the error Cannot find module 'tslib' was caused by special builder @nrwl/node:build in my Angular repository (I'm using nrwl/nx ...
Read more >
tslib - npm
Runtime library for TypeScript helper functions. Latest version: 2.4.1, last published: 2 months ago. Start using tslib in your project by ...
Read more >
add module tslib - Code Examples & Solutions For This ...
TypeScript 3.9.2 or later npm install tslib // TypeScript 3.8.4 or earlier npm install ... typescript declare module · add module.ts to a...
Read more >
This syntax requires an imported helper but module 'tslib ...
To solve the error "This syntax requires an imported helper but module 'tslib' cannot be found", install tslib by running npm install -D...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found