Skip to content

stripInternal should remove the export keyword from declarations instead of removing them entirely #45307

@DetachHead

Description

@DetachHead

Bug Report

my use case for stripInternal is a type definition i want to share between two different files in my project, but not expose as part of the public api. since stripInternal removes the type entirely it breaks the types that use it.

🔎 Search Terms

stripInternal

🕗 Version & Regression Information

4.4.0-dev.20210803

💻 Code

foo.ts

/** @internal */
export type Foo = 1

export type Bar = Foo | 'bar'

bar.ts

import {Foo} from "./foo";

export type Baz = Foo | 'foo'

🙁 Actual behavior

foo.d.ts

export declare type Bar = Foo | 'bar'; //Foo doesn't exist, so Bar is now just an alias for any

bar.d.ts

import { Foo } from "./foo"; //Foo doesn't exist
export declare type Baz = Foo | 'foo'; //Baz is now just an alias for any

🙂 Expected behavior

perhaps the export keyword is stripped from internally defined types and they instead are duplicated wherever they are used in the declarations

foo.d.ts

type Foo = 1
export declare type Bar = Foo | 'bar';

bar.d.ts

type Foo = 1
export declare type Baz = Foo | 'foo';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions