Skip to content

Declaration file has wrong reference path for composite projects #37928

Closed
@timocov

Description

@timocov

TypeScript Version: 3.9.0-dev.20200413, 3.8.3

Search Terms: composite projects, declaration files, paths, reference, baseUrl

Code

  1. Download zip with the project ts-bug.zip
  2. npm install
  3. npm run build-non-composite - it should be fine

Then, if you run npm run build - there are 2 errors:

lib/src/common/nominal.d.ts:2:55 - error TS2304: Cannot find name 'MyNominal'.

2 export declare type Nominal<T, Name extends string> = MyNominal<T, Name>;
                                                        ~~~~~~~~~

lib/src/common/nominal.d.ts:1:22 - error TS6053: File 'C:/projects/src/common/types.d.ts' not found.

1 /// <reference path="../../../src/common/types.d.ts" />
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And if you run npm run build-baseUrl - there are another 2 errors:

lib/src/common/nominal.d.ts:2:55 - error TS2304: Cannot find name 'MyNominal'.

2 export declare type Nominal<T, Name extends string> = MyNominal<T, Name>;
                                                        ~~~~~~~~~

lib/src/common/nominal.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

This is pretty similar to #31696. In this case we have 2 bugs:

  1. For npm run build incorrect generated path for reference path (it exits for 1 more folder).
  2. For npm run build-baseUrl (which is differ from build case in the only baseUrl compiler option in common sub-project) incorrectly replaced refernce path with reference types, so no project could use it because they might (and will) not have the same baseUrl option.

Related Issues: #31696, #25600

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions