Skip to content

How to import one node_modules/@types and pin the reference to it like IncludeDeclarations works #848

Closed
@presto41

Description

@presto41

In my code is some function which return object which has of type from node_modules/@types.
I need to include this type because I need to show reference to this @type and I need to show this @type too. So I was trying those ways:

  1. added path to this type in 'src' statement, e.g.: '**/node_modules/@types/someType/index.d.ts'
  2. by set includeDeclarations as true

First way had been ignored. I thought at the first look that the second is working well but I observed something. I observed that the full of node_modules had been including into my documentation. But I don't need all of node_modules into my documentation. I need only this one type.

I'm so disappointed because without includeDeclarations my documentation cannot to find node_modules type but with it - is including a lot of redundant code.

Is any way to do it?

There are my typedoc configs.
First of them from point 1.:

typedoc: {
    build: {
        options: {
            module: 'commonjs',
            out: '../MyDocumentation/',
            name: 'MyApp',
            target: 'es5',
            exclude: [
                '**/folderA/*.d.ts',
                '**/folderB/*.d.ts'
            ],
            excludePrivate: true,
            externalPattern: "**/*/{fileX,fileY,fileZ}.ts",
            mode: 'file'
        },
        src: [
            'folderA/*.ts',
            'folderB/*.ts',
            **/node_modules/@types/someType/*.d.ts
        ]
    }
}   

Second from point 2:

typedoc: {
    build: {
        options: {
            module: 'commonjs',
            out: '../MyDocumentation/',
            name: 'MyApp',
            target: 'es5',
            exclude: [
            	'**/node_modules/**',
                '**/folderA/*.d.ts',
                '**/folderB/*.d.ts'
            ],
            includeDeclarations: true,
            excludePrivate: true,
            externalPattern: "**/*/{fileX,fileY,fileZ}.ts",
            mode: 'file'
        },
        src: [
            'folderA/*.ts',
            'folderB/*.ts',
        ]
    }
}        

I'm looking for a way how to include my @type but without a rest of node_modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions are especially encouragedquestionQuestion about functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions