Skip to content

Declaration emit is broken for parameters marked /* @internal */ #33350

Closed

Description

.ts:

interface TypeChecker {
    getContextualType(node: Expression, /* @internal */ contextFlags?: ContextFlags): Type | undefined;
}

.d.ts:

interface TypeChecker {
    getContextualType(node: Expression, 
: Type | undefined;

Activity

  1. sheetalkamat commented on Sep 10, 2019

    @sheetalkamat
    Member

    Seems like multiple issues.. This is d.ts emit through transform. The one you see is because of copying and updating d.ts as per changes in prepends through tsbuild info.

    c:\TypeScript\built\local>type a.ts
    interface TypeChecker {
        getContextualType(node: string, /* @internal */ contextFlags?: number): string | undefined;
    }
    c:\TypeScript\built\local>node tsc.js --stripInternal a.ts --d
    
    c:\TypeScript\built\local>type a.d.ts
    interface TypeChecker {
        getContextualType(node: string, /* @internal */ contextFlags?: number): string | undefined;
    }
    
    
  2. juanrgm commented on Sep 15, 2022

    @juanrgm

    Same case here with TypeScript 4.8.3.

    • Error
     '*/' expected.
    
    • index.d.ts
    // ...
                lastIndexOf(searchElement: import("@anymodel/docker-compose").Volume, fromIndex?: number | undefined): number;
                every<S extends import("@anymodel/docker-compose").Volume>(predicate: (value: import("@anymodel/docker-compose").Volume, index: number, array: import("@anymodel/docker-compose").Volume[]) => value is S, thisArg?: any): this is S[]; /**"],
              },
    // ...
    • A portion of index.ts
    // ...
    {
      includeIgnored: ["**/.history/**"],
    }
    // ...

    Unfortunately I can't create a POC because the code is very complex and when I delete some parts the problem fixes. But basically the generation stopped after of this is S[]; /**"], and then the rest of the file contains the original source code.

    Workaround?

    "*" + "*/.history/**" // 😅
  3. RyanCavanaugh commented on Sep 2, 2026

    @RyanCavanaugh
    Member

    This is fixed by retirement of the affected build path.

    With TypeScript 5.4.0-dev.20240220, a composite project reference using prepend, outFile, and stripInternal emits malformed declaration text after the referenced source changes:

    getContextualType(node: string, 
    * @internal */ contextFlags?: number
    : number | undefined;

    A consumer of that declaration reports TS1003, TS1138, TS1161, and TS1128. TypeScript 5.5.0-dev.20240221 is the first removal build and reports TS5102: Option 'prepend' has been removed. Current native TypeScript likewise rejects the retired bundled-output configuration.

    The removal shipped in #57452; #57472 removed the remaining implementation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions