angular-meteor
angular-meteor copied to clipboard
typescript compiler ignoring *.d.ts files
When reporting a bug, please be sure to include the following:
- [x] A descriptive title
- [x] An isolated way to reproduce the behavior (example: GitHub repository with code isolated to the issue that anyone can clone to observe the problem)
- [x] What version of
angular-meteor
you're using, and the platform(s) you're running it on - [x] What packages or other dependencies you're using
- [x] 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
Could you try to add this on the top the file?
/// <reference path="./<declaration-file-name>.d.ts" />
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'" . :-)
Could you try to add this on the top the file?
/// <reference path="./<declaration-file-name>.d.ts" />
Is adding the decleration always necessary?