Closed
Description
Other ways to extend contents of tsconfig.json
files
- Want people to be able to merge properties from other
tsconfig.json
s.- Today, you can only override them, sometimes don't inherit them.
- Could look like an array of properties you want merged, or an object that can be merged.
- Could also look like a field called
extends
ormerge
which implies merging behavior for every listed property, and can add contents as well.
- It's not just merging - also want to be able to do a "raw" copy so that things become relative to the current
tsconfig.json
- e.g. inherit
outDir
in a way where things become relative to the currenttsconfig.json
, rather than being normalized and copied from the originaltsconfig.json
- One idea is to have a
raw
field (similar to amerge
field) that lists the properties you want to do a raw copy of. - Another option is to use an interpolation string like
"${workspaceDir}"
.- Some support around this idea because it's similar to
tsconfig.json
.
- Some support around this idea because it's similar to
- e.g. inherit
- Having a weird time understanding use-cases with
references
due to transitive dependencies?- Something with dual builds.
- Agree with solving the problem space, but trying to find good ergnomics.
- Are there order-dependency risks?
- Path mapping, type roots, stuff like that.
- Could have imagined if we did it all over again today, we'd do
compilerOptions
being overrides, andmergedCompilerOptions
. - If we did it all over again, would we have just picked merge as the default strategy?
- Certainly for
paths
,typeRoots
, maybelib
. - In a sense we do merge, but it's just not deep.
- Certainly for
- So should we try to change the default of how
tsconfig.json
inheritance operates?- Fix everything in TypeScript 6.0
- That might be a way bigger break than you realize!
- VS Code does automatic merging and interpolated variables.
- No way to override! Only merge!
- If we did interpolated variables.
- Path of configuration file
configLocation
configFolder
configDirectory
projectLocation
projectFolder
projectDirectory
fileName
- could model a project build for different targets liketsconfig.cjs.json
andtsconfig.esm.json
- "Please let's not talk about project references here."
- Editor's note: :(
- "Please let's not talk about project references here."
- Path of configuration file
- Consensus around introducing an variable name like
${configDirectory}
once we know what the actual name is.
Instantiate earlier inferred constraints in conditional type
- Bug a long time ago - type parameters would leak when they referred to themselves in a conditional type extends clause.
- Fixed the issue for a subset of types that were considered directly generic - but not instantiations of object types with type parameters.
- New fix includes the
infer
type parameters in the new inference context. - ✅
Avoid creating rest elements with errorType
when any
is spread
- Made a change where if you spread in something of type
any
into the end of an array and then try to destructure it, you end up withunknown[]
.- Why? When you spread
any
, you end up witherrorType
as the rest element type. But then you end up withunknown[]
when you slice the end off.
- Why? When you spread
- The PR seems right, maybe lacking a test for spreading in other kinds of
any
types like the error type itself. - ✅
Activity