Commit b09052c
fix(parse-tsconfig): preserve files when include is also present (#128)
When a tsconfig extends a base config that defines `files`, and the
child config defines `include`, the inherited `files` array was deleted
(`delete config.files`). TypeScript itself preserves both properties —
`files` entries are always included regardless of `include`/`exclude`.
**Before:** `files` from extended config silently dropped when child has
`include`
**After:** `files` paths are normalized instead of deleted, matching
TypeScript behavior
### Scenario
```json
// tsconfig.base.json
{ "files": ["types/globals.d.ts"] }
// tsconfig.json
{ "extends": "./tsconfig.base.json", "include": ["src"] }
```
`get-tsconfig` returned `{ include: ["src"] }` — `files` was lost.
TypeScript resolves both: the `files` entries *and* the `include` glob.
### Verified against TypeScript source
`commandLineParser.ts` lines 3463–3473: `files`, `include`, and
`exclude` are independently inheritable via
`setPropertyInResultIfNotUndefined`. Line 3143: the default `include:
["**/*"]` only applies when both `files` and `include` are absent.
---------
Co-authored-by: Hiroki Osame <hiroki.osame@gmail.com>1 parent e64637d commit b09052c
2 files changed
Lines changed: 75 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
236 | 237 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 238 | + | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
143 | 216 | | |
144 | 217 | | |
145 | 218 | | |
| |||
0 commit comments