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.

Using declarationMap is causing unexpected errors

See original GitHub issue

Type of Issue

[ x] Bug Report
[ ] Feature Request

(perhaps it’s an unsupported ts feature, and we should threat this as a feature request)

Description

I’ve tried to use the tsconfig property declarationMap for getting sources with generated libraries. (see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#new---declarationmap). Enabling this flag on a project in an angular-cli generated project (either ng 8 or v9.0.0-rc.4), causes the following issues:

ERROR: error TS5069: Option 'declarationMap' cannot be specified without specifying option 'declaration' or option 'composite'.
An unhandled exception occurred: error TS5069: Option 'declarationMap' cannot be specified without specifying option 'declaration' or option 'composite'.

The message indicates that I should add ‘declaration’ or ‘composite’ as well. In the default generated tsconfig.lib.json, the declaration is actually set to true. I’ve tried to enable the ‘composite’ flag as well, but this is causing other issues.

How To Reproduce

  • create a new cli workspace (ng new mywebsite)
  • create a new project in the workspace (ng g library myproject)
  • add the flag declarationMap to projects/myproject/tsconfig.lib.json
  • build the library (ng build myproject)

Expected Behaviour

I was expecting that .d.ts.map files would be generated

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 5.7.1
@angular/*: 8.3.20
typescript: 3.5.3
rxjs: 6.4.0
node: v10.16.0
npm: 6.13.1

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
arobinsoncommented, Feb 26, 2020

While I understand being busy, this feature is very important for mono-repo development. Without this working, VS code ends up loading the *.d.ts files instead of the source files.

Example layout:

project-root/
  angular-application/
    src/
      foo.ts
  angular-libraries/
    projects/
      some-library/
        src/
          lib/
            bar.ts
  other-local-library/

In the angular-application, to get Ivy working, one cannot use symlinks and tsconfig paths to get angular-application to reference something in one of the libraries since it uses package.json and node_modules. When trying to go to the definition Bar defined in angular-libraries/projects/some-library/src/bar.ts file from angular-application/src/foo.ts file, opened file is angular-application/node_modules/some-library/lib/bar.d.ts which is not helpful at all if you mean to edit the bar.ts source code.

If I understand this right, having the declarationMap working would allow that bar.ts file be loaded instead, making the development experience in a mono-repo much better.

0reactions
github-actions[bot]commented, Jul 12, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using declarationMap is causing unexpected errors
In the default generated tsconfig. lib. json , the declaration is actually set to true. I've tried to enable the 'composite' flag as...
Read more >
TypeScript errors and how to fix them
Common Errors​​ Below you find a list of common TypeScript errors along with the buggy code and its fixed version.
Read more >
TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or ... This can cause some errors...
Read more >
error TS5023: Unknown compiler option 'declarationMap'
When running my program I get the following error: error TS5023: Unknown compiler option 'declarationMap'. My tsconfig file looks like this:
Read more >
Compiler Options - Microsoft Open Source
Specifies an array of files to include in the program. An error occurs if any of the files can't be found. composite. Default:...
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