Closed clintharris closed 3 years ago
Thanks! This is cool. This is just for the "lib" imports right, not the main import? Is it intended that I'd also merge #57?
Right, I was thinking it would just cover the stuff in lib
and not the main import. It's an alternative to #57 (which wasn't working for me when I tried to import stuff from lib
). But I think, given the discussion in #23, this PR is not the best solution.
Closing, per discussion in #23.
Summary
This PR modifies the build script to include generating ambient type declaration files. The files are generated in the "legacy API"
lib/
folder so that the existing paths used to reference the CommonJS modules will continue to work with the Typescript compiler. For example, the Typescript compiler will not complain about the following:Changes
build-typedefs
npm script. This writes.d.ts
files to thelib/
directory.build
npm script to to runbuild-typedefs
..gitignore
so that the type declaration files (lib/*.d.ts
) are ignored.Example
Result:
How to try it out
I published a version with these changes to make it easier to test: