Skip to content

Somtimes generating inline imports for d.ts files instead of using globally imported symbols #30258

@CarstenLeue

Description

@CarstenLeue

TypeScript Version: [email protected]
I cannot use a more recent version, since I am using the Angular build process that requires >=3.1.1 <3.3.

I am opening this issue as requested by defect
microsoft/rushstack#1067

The problem looks related to #25511 but that issue has been closed, still the problem persists for me.

Problem statement:

The d.ts file generated during my compile step looks like this:

export declare const authContentFeatureReducer: {
    [AUTH_CONTENT_FEATURE]: import("redux").Reducer<Record<string, import("@ibm-wch-sdk/api").AuthoringContentItem>, import("..").PayloadAction<string> | import("..").PayloadAction<import("@ibm-wch-sdk/api").AuthoringContentItem>>;
};

It references types from other modules via inline import statements. This causes a problem when generating documentation via the https://www.npmjs.com/package/@microsoft/api-documenter tool, because these inline import statements appear as is in the generated documentation. Instead of just the types they point to. This renders the documentation basically unreadable.

Expected behaviour
I would expect output similar to this:

import { Reducer } from 'redux';
import { AuthoringContentItem} from '@ibm-wch-sdk/api';
import { PayloadAction } from '..'

export declare const authContentFeatureReducer: {
    [AUTH_CONTENT_FEATURE]: Reducer<Record<string, AuthoringContentItem>, PayloadAction<string> | PayloadAction<AuthoringContentItem>>;
};

The actual source code looks like this:

import { authoringContentReducer } from './auth.content.reducer';

export const AUTH_CONTENT_FEATURE = 'authContent';

export const authContentFeatureReducer = {
  [AUTH_CONTENT_FEATURE]: authoringContentReducer
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions