Skip to content

[api-extractor] types are exported as 'import' clause instead of the imported symbol #1067

@CarstenLeue

Description

@CarstenLeue

I have an interface such as this:

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

export const AUTH_CONTENT_FEATURE = 'authContent';

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

with

import { Reducer } from 'redux';
...

export const authoringContentReducer: Reducer<
  AuthoringContentState,
  | AddAuthoringContentAction
  | SetAuthoringContentAction
  | RemoveAuthoringContentAction
> = ...;

the authContentFeatureReducer is appears in the api export as

        {
          "kind": "Variable",
          "canonicalReference": "authContentFeatureReducer",
          "docComment": "",
          "excerptTokens": [
            {
              "kind": "Reference",
              "text": "authContentFeatureReducer"
            },
            {
              "kind": "Content",
              "text": ": "
            },
            {
              "kind": "Content",
              "text": "{\n    ["
            },
            {
              "kind": "Reference",
              "text": "AUTH_CONTENT_FEATURE"
            },
            {
              "kind": "Content",
              "text": "]: import(\"redux\")."
            },
            {
              "kind": "Reference",
              "text": "Reducer"
            },

i.e. the reference to the Reducer type from redux is includes as an import in the type declaration instead of just using the Reducer value.

This is in particular problematic in the documentation generated from this structure, the fully rendered doc in my example is:

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

which is basically unreadable.

I would have preferred the types to be referenced (and in particular documented) just by their name, not their import path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    external issueThe root cause is with an external component that needs a fix or workaround

    Type

    No type

    Projects

    Status

    AE/AD

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions