Skip to content
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

typescript compiler ignoring *.d.ts files #1909

Open
5 tasks done
atao60 opened this issue Apr 22, 2018 · 3 comments
Open
5 tasks done

typescript compiler ignoring *.d.ts files #1909

atao60 opened this issue Apr 22, 2018 · 3 comments

Comments

@atao60
Copy link

atao60 commented Apr 22, 2018

When reporting a bug, please be sure to include the following:

  • A descriptive title
  • An isolated way to reproduce the behavior (example: GitHub repository with code isolated to the issue that anyone can clone to observe the problem)
  • What version of angular-meteor you're using, and the platform(s) you're running it on
  • What packages or other dependencies you're using
  • The behavior you expect to see, and the actual behavior

A demo is available on atao60/meteor-angular-no-type-declaration. This demo is based on Angular Meteor bare MeteorCLI example.

This demo is updated to Meteor 1.6.1.1.

When:

  • using an npm package without type declaration, eg [email protected],
  • and providing type declaration file, eg declarations.d.ts,

this last file is ignored. I get warning messages such as:

[server]: ES2015 modules Compilation: 645.388ms
server/main.ts (1, 25): Could not find a declaration file for module 'dir-obj'. 'node_modules/dir-obj/index.js' implicitly has an 'any' type.
  Try `npm install @types/dir-obj` if it exists or add a new declaration (.d.ts) file containing `declare module 'dir-obj';`
server/main.ts (12, 24): Parameter 'dirPath' implicitly has an 'any' type.

I have been unable to force angular-compilers to take in account any d.ts file.

dev config

$ uname -srvmpio
Linux 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
@ardatan
Copy link
Collaborator

ardatan commented May 23, 2018

Could you try to add this on the top the file?

/// <reference path="./<declaration-file-name>.d.ts" />

@atao60
Copy link
Author

atao60 commented May 26, 2018

After inserting the reference path at the beginning of server/main.ts:

sed -i '1 i\
/// <reference path="../declarations.d.ts" />
' server/main.ts

No more "Could not find a declaration file for module 'dir-obj'" . :-)

@yusufkhan07
Copy link

Could you try to add this on the top the file?

/// <reference path="./<declaration-file-name>.d.ts" />

Is adding the decleration always necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants