Can't import custom type definitions
See original GitHub issueType of Issue
[x ] Bug Report
[x ] Feature Request
(not sure if this is a bug, or a missing feature... or if I'm just doing it wrong)
Description
I have been using a JS library (d3-context-menu) successfully with ng-packagr up until now. Since upgrading to Typescript 4.4.2 I can’t use the require syntax anymore for that version, so I’m forced to created a type definition file. However, I cannot get my project to use this type definition at all. It will work with another project that doesn’t use ng-packagr, so there must be something I’m missing to get that type definition to work.
Help? See here for a more detailed description of the problem, with screenshots: https://stackoverflow.com/questions/71178933/how-to-get-ng-packagr-to-recognize-a-typescript-type-definition
Here is the repro app https://github.com/alexanderlevitsky/repro-app
How To Reproduce
Import a JS library such as d3-context-menu and create a type definition for it. Attempt to compile the project.
Expected Behaviour
Type definition should be recognized and allow the library to be used as it could be before, with the require syntax.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 13.2.0
@angular/*: 13
typescript: 4.4.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
Thinking about this a bit more, since this is a library including
.d.ts
would require consumers to enable skipLibCheck which isn’t great.Therefore a better way to use custom type definitions in a library is use the
Triple-Slash Directives
.Rename
decs.d.ts
tosrc/decs.ts
and Insrc/lib/menu.service.ts
add/// <reference path="../decs.ts" />
.This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.