Skip to content

In certain cases TS 2.9 outputs incorrect definitions (.d.ts) #25511

Closed
@d4rkr00t

Description

@d4rkr00t

TypeScript Version: 2.9.2 and 3.0.0-dev.201xxxxx

Search Terms: relaxed, declarations

Expected behavior:
Definitions have correct import statements.

Actual behavior:

In certain cases e.g. monorepo structure where dependencies are linked inside packages from the root node_modules folder (you can read about that more here: bolt) output .d.ts files contain pretty weird paths...

Code: https://github.com/d4rkr00t/tsc29-test-relaxed-resolve

// packages/package-a/src/index.ts
import { css } from 'styled-components';

export const styles = css`
	display: table;
`;

Outputs definition file:

// packages/package-a/dist/index.d.ts
export declare const styles: import("../../../../../../../../Users/username/tsc29-test-relaxed-resolve/packages/package-a/node_modules/styled-components").InterpolationValue[];

I've also tried that with TS 3.0 it's a little bit better, first file gets correct deffinitions:

// packages/package-a/dist/index.d.ts
export declare const styles: import("styled-components").InterpolationValue[];

But another module that imports the previous one still gets wrong definitions (even though, they look sort of reasonable, but probably the fact that package-a is inside node_modules should indicate that this is a module, i'm not sure if it's fair to assume that :) ):

export declare function getStyles(): import("../../package-a/node_modules/styled-components/typings/styled-components").InterpolationValue[];

In version below 2.9 we had to import those things manually and it used to work, but now we can't do it manually anymore as it has no difference...

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions