Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundled types (.d.ts) in npm package #462

Closed

Conversation

pmstss
Copy link
Contributor

@pmstss pmstss commented Mar 3, 2019

Pull Request Description:
I've enabled d.ts generation in tsconfig.json, then added and configured DtsBundleWebpack plugin to generate d.ts bundle compatible with npm publishing. typings property in package.json is adjusted too.

Motivation:
Utilize types power in pretty complex jsPDF-AutoTable config without import of source files. Currently in project I have to had something like:

import { Cell, Table } from 'jspdf-autotable/src/models';

which is generally bad practice and causes issues with tsc.

@pmstss pmstss changed the title Types (.d.ts) in npm package wip: Types (.d.ts) in npm package Mar 3, 2019
@pmstss
Copy link
Contributor Author

pmstss commented Mar 3, 2019

Not that easy :( Trying to find workaround for TypeStrong/dts-bundle#57

@simonbengtsson
Copy link
Owner

This is great! ❤️

@pmstss
Copy link
Contributor Author

pmstss commented Mar 4, 2019

Was not able to tame dts-bundle/DtsBundleWebpack plugin.
More straightforward way would be add auxiliary file with all exports and skip bundling (will have multiple d.ts files in ./dist).
Will submit new PR soon. :)

@pmstss pmstss closed this Mar 4, 2019
@pmstss pmstss changed the title wip: Types (.d.ts) in npm package Bundled types (.d.ts) in npm package Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants