Skip to content

TSC creates an invalid triple slash reference in declarations #37375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elevatebart opened this issue Mar 12, 2020 · 3 comments
Closed

TSC creates an invalid triple slash reference in declarations #37375

elevatebart opened this issue Mar 12, 2020 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created

Comments

@elevatebart
Copy link

TypeScript Version: 3.6.2 - 3.8.3

declarations, reference, invalid, optimisations

Code

Repro Repo

Clone the repo, install using yarn (or npm) and run the compile:types script

Expected behavior:

lib/client/rsg-components/slots/index.d.ts should be

/// <reference types="react" />
export declare const DOCS_TAB_USAGE = "rsg-usage";
declare const _default: (config?: any) => {
    docsTabs: {
        id: string;
        render: import("react").FunctionComponent<{
            props: {
                methods: import("react-docgen").MethodDescriptor[];
            };
        }>;
    }[];
};
export default _default;

Actual behavior:

Instead there is a line added here line #2 that complains as invalid.

/// <reference types="react" />
/// <reference types="lib/typings/dependencies/react-docgen" />
export declare const DOCS_TAB_USAGE = "rsg-usage";
declare const _default: (config?: any) => {
    docsTabs: {
        id: string;
        render: import("react").FunctionComponent<{
            props: {
                methods: import("react-docgen").MethodDescriptor[];
            };
        }>;
    }[];
};
export default _default;

I traced the issue back to 3.6.2. In 3.5 it uses the relative path of the file which does not break.

Playground Link:

@elevatebart elevatebart changed the title TS create an invalid reference in declarations TSC creates an invalid triple slash reference in declarations Mar 12, 2020
@AviVahl
Copy link

AviVahl commented Mar 13, 2020

Maybe related to #35343

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 16, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.0 milestone Mar 16, 2020
@sheetalkamat
Copy link
Member

The root cause of this is #39695

@sheetalkamat sheetalkamat added Duplicate An existing issue was already created Bug A bug in TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels Aug 4, 2020
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants