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
feat(allow-scripts): generate & ship typescript declarations #617
feat(allow-scripts): generate & ship typescript declarations #617
Conversation
9443213
to
eea6bed
Compare
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
f671bab
to
21c0e5e
Compare
740f172
to
ec493f1
Compare
9b9495d
to
62065a6
Compare
ec493f1
to
3bd23a0
Compare
3bd23a0
to
9a2e08e
Compare
6ec7fce
to
6657c9b
Compare
9a2e08e
to
4e2ac0f
Compare
6657c9b
to
be1ccb5
Compare
4e2ac0f
to
e74d70e
Compare
fa30ad5
to
ea3095f
Compare
e74d70e
to
8bed386
Compare
ea3095f
to
0347a1d
Compare
8bed386
to
af6de6e
Compare
0347a1d
to
227df10
Compare
af6de6e
to
b01880d
Compare
227df10
to
2b1eb8e
Compare
171e4fc
to
10ddb3a
Compare
9f11a04
to
5e27065
Compare
10ddb3a
to
b313684
Compare
This adds `.d.ts` generation to `@lavamoat/allow-scripts`. - Many type defs added to `src/types` for those modules which do not have them (nor are there any published to DefinitelyTyped). In the future, some of these could be submitted to DefinitelyTyped, if we wish. - Upgrade `yargs` - Create reusable TS configuration supporting incremental builds - Declaration files generated at build time and shipped in the `types` folder (which is now in `.gitignore`) - Created `.depcheckrc` - Added, updated, removed and/or fixed many docstring types Note: the uncommon `skipLibCheck = false` setting in this module's `tsconfig.json` enables typechecking of the `.d.ts` files themselves. These files are not compiled.
b313684
to
3c0478d
Compare
I guess this is still relevant and intended to target |
yeah I think it's because it was targeting a branch that got deleted, it automatically closed, which is not what I expected to happen. |
I would also have expected this PR to automatically retarget. Not sure if GH changed behavior,my memory is incorrect, or if there's some subtlety behind the difference in outcome. |
This is a PoC for creating (and shipping) declaration files for LavaMoat packages.
Right now, I've fully typed the sources (not the tests) of
@lavamoat/allow-scripts
, which now validates the types in "strict" mode. TypeScript is configured for incremental builds (preferable for monorepos), but only builds one module as a PoC.To generate types, execute
npm run build:types
in the@lavamoat/allow-scripts
workspace. They will be output intopackages/allow-scripts/types
(which is not under VCS).I added available type declarations (from DefinitelyTyped), but I had to write a handful of my own for external modules. These do not appear to be re-exported. AFAICT (but I haven't tested it!) there aren't any type declarations that are needed as production dependencies (in
@lavamoat/allow-scripts
, anyway).I took some liberties tweaking existing types (narrowing where appropriate, separating
@typedef
s so that descriptions would be picked up, etc.). I'd prefer if we used theT[]
syntax for arrays instead ofArray<T>
, but that's just my personal preference and I stuck to the current convention.I note that these
.d.ts
files I created have semicolons which is a byproduct of my IDE's default formatting. If we intend to keep any of these around, I'd recommend pulling in@typescript-eslint/plugin
and its ilk.