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.

typings.d.ts is not working as described in readme

See original GitHub issue

I tried to add a global typings.d.ts exactly as described in readme but TypeScript compiler says Cannot find module 'typeless-package'.

Maybe the description is outdated?

Do I have to add it manually to tsconfig.json? If so i get the same error:

"typeRoots": [ "../node_modules/@types", "./typings.d.ts" ]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
artuskacommented, Aug 1, 2017

@osadan

When I add typings.d.ts to the typeRoots config I get:

ERROR in E:/Dropbox/angular2-cli/src/typings.d.ts (14,2): Statements are not allowed in ambient contexts.

Oh, I found there is no need to add typings.d.ts to the typeRoots config — just write your declarations in typings.d.ts and it works.

declare var module: NodeModule;
declare var ymaps: ymaps;

interface NodeModule {
    id: string;
}

interface ymaps {
    geometry: any;
    shape: any;
    templateLayoutFactory: any;
    Balloon: any;
    Placemark: any;
}
1reaction
MickLcommented, Jan 27, 2017

Im not sure if module is up to date in typescript? Didnt it got replaced by namespace?

I tried:

export declare namespace TypelessPackage {
  export function test():boolean;
}

Then:

import {TypelessPackage} from "../../typings";
TypelessPackage.test();

But it says Module not found: Error: Can't resolve '../../typings' in '/<<path>>/src/app/shared'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to find typings.d.ts and declare modules in angular 2 ...
This looked very promising, but I was forced to declare the variables in the component itself (in the ts file) instead of a...
Read more >
TypeScript rules for Bazel - bazelbuild/rules_nodejs
The only reason to use raw tsc is if you want to compile a directory of .ts files and cannot enumerate them ahead-of-time...
Read more >
File: README — AWS SDK for JavaScript
js typings, you may encounter compilation issues when using the typings provided by the SDK in an Angular project created using the Angular...
Read more >
Usage of Angular libraries published to npm
Typically, library packages include typings in .d.ts files; see examples in node_modules/@angular/material . If the package of your library does not include ...
Read more >
TypeScript and esbuild - Janessa Garrow
esm.js , and index.d.ts file. Since our TypeScript files from src are being compiled, bundled, ...
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