Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/types: add main and types fields #823
base: master
Are you sure you want to change the base?
feat/types: add main and types fields #823
Changes from all commits
bbda469
3c8c37d
77c0453
26b2866
41c7fdf
ad4f04e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of using the exact type that TSDX modifies this to, although that may not be possible to override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, TSDX itself uses
RollupOptions
internally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I ran
tsc
over atsdx.config.js
with the proper import and a// @ts-check
andallowJs: "true"
etc and that actually failed because of the lack of exact typing. E.g.:$ tsc --noEmit tsdx.config.js:13:5 - error TS2532: Object is possibly 'undefined'. 13 config.plugins.push(
Now the problem is that I'm not entirely sure how to do this in TS or if it's possible to. TSDX's Rollup config should conform to
RollupOptions
but should also be more specific thanRollupOptions
-- e.g. we should know thatconfig.plugins.push
is possible without any type-casting.Of course, TSDX Rollup config could have its own interface that extends
RollupOptions
, but that would be the naive route and could still cause users some type-checking problems. The config is complex enough that I'd like it to be inferred (especially the plugins' types, since users may override them) while still conforming toRollupOptions
(so we don't get problems like #371 ). I'm not sure if that's possible in TS or if I just haven't been able to figure out how to do it in TS.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't comment at the top of the file, but per my other comment, we probably want to add
// @ts-check
to the top of this and the example file.Adding
allowJs
+checkJs
to templates' and the tests'tsconfig
probably makes more sense long-term, but there will probably be some ramifications to that and may want to wait to do that until #871 is fixed and creates twotsconfig
s, one forbuild
and one for type-checking. I definitely need to test that more before adding.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You had
require('..')
before, so it should either be that ('..'
) or this, which works in VSCode but may not work during the test phase where this gets moved to the "staging" dir. Buttsdx build
can't type-check this anyway (otherwise we'd be usingtsdx.config.ts
). Might addtsc
tests in the future for things like #871 though...