Skip to content

TypeScript index.d.ts referenced incorrectly in package.json #62

@lazd

Description

@lazd

Though types are included as dist/index.d.ts, package.json references types/index.d.ts, which is not published.

Details

See the package.json here that references types/index.d.ts: https://unpkg.com/browse/posthtml-render@2.0.6/package.json

See types/index.d.ts doesn't exist: https://unpkg.com/browse/posthtml-render@2.0.6/types/index.d.ts

See dist/index.d.ts exists: https://unpkg.com/browse/posthtml-render@2.0.6/dist/index.d.ts

Reproduction (Code)

npm install posthtml-render@2.x
cat node_modules/types/index.d.ts
# cat: node_modules/types/index.d.ts: No such file or directory

Note that 1.4.0 does not suffer from this issue:

npm install posthtml-render@1.x
cat node_modules/lib/index.d.ts # hooray

Possible fixes

Change package.json

It seems like simply changing package.json to have "types": "dist/index.d.ts" would be the answer, but that may cause issues when developing locally with an unbuilt package using npm link as the types would exist in types/index.d.s instead of the referenced dist/index.d.ts.

Publish types/

The build system would have to be changed to not build dist/index.d.ts, and the publish process would have to include types/. I did a quick check to see of .npmignore was ignoring types/, but its not, so I'm curious as to why this isn't already published...

Environment

OS node yarn package
macOS 10.15.7 v14.17.1 v1.22.4 v2.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions