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
Adding "extends": support to
'ts-node'
loading fromtsconfig.json
#1292Adding "extends": support to
'ts-node'
loading fromtsconfig.json
#1292Changes from 1 commit
8e771ff
3340af3
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.
Nit: get rid of the
filter().map()
chaining. We prefer code likeconst
,if()
,for(const a of b)
, etc.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.
@cspotcode It's not for everyone 🐼. Once you have a look over the logic itself, I'll swap it out.
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.
Does this work when ./bar/tsconfig.json refers to ./bar/tsconfig2.json by relative path? Because the path is not relative to cwd? Does it work for
"extends": "@tsconfig/node14/tsconfig.json"
? (https://github.com/tsconfig/bases)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.
Regarding relative paths...
Not sure if I want to say yes, I do use this myself and I my cwd wasn't relative, but then again I am doing other stuff that might impact it.
Good call, would do best to extract
dirname/basename
from current config in order to make relative paths work - but I gotta check first.There is another approach and that is to let
ts
itself try to find the file, there is a function that for that last I checked.Regarding
@tsconfig/node14/tsconfig.json
Yeah no chance that would work.
I am not familiar with that, is that something you distribute or TS?
If it's the latter, then I'd reckon there wouldn't be a
ts-node
key there?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.
We'll need tests for this, and we'll need to support typescript's
"extends"
resolution behavior. @tsconfig/node14 was just an example; our users can choose to"extends"
from anywhere that typescript supports, and we'll need to match that behavior. Ideally, we figure out how TypeScript is doing this logic and do the exact same, using as many TypeScript APIs as possible to avoid duplication.https://www.typescriptlang.org/tsconfig#extends
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.
Right, if TS exposes that, then I guess best bet is to use it, but to reimplement it is overkill.
In general, I think the simplest approach is just following the links.
In regards to your previous points about relative paths, this is an easy fix:
However I don't care much for
extends: "@tsconfig/node14/tsconfig.json"
, on the premise that I just don't approve of this path they're going down on.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.
Using relative paths and not CWD now.
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.
Unfortunately tsc already does this so we need to match. Otherwise it gets confusing and we need to document how our behavior deviates, and I'll be the one answering the issues that get files.
I certainly understand why you might choose not to use this feature on your projects, but for
ts-node
, we need to match TSC's behavior or else we're making things confusing.