-
Notifications
You must be signed in to change notification settings - Fork 2
processors/typescript: depend on files listed in includes
in nearest tsconfig.json
#17
base: main
Are you sure you want to change the base?
Conversation
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.
Good addition!
2ddcc39
to
6085e67
Compare
6085e67
to
8641356
Compare
return []; | ||
} | ||
|
||
const json = ts.parseJsonText( |
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.
much nicer :)
expect(result).toStrictEqual({ | ||
missing: new Map(), | ||
resolved: new Map([ | ||
[fixture('tsconfigs', 'project', 'project.ts'), new Set([decl1])], |
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.
[fixture('tsconfigs', 'decls', 'one.d.ts'), new Set([decl2])], | ||
[fixture('tsconfigs', 'decls', 'two.d.ts'), new Set([decl1])], |
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.
this seemed a little odd to me at first but it makes sense. If I have decls/a.d.ts
and decls/b.d.ts
which uses types from a
, then any file that uses types from b
should transitively depend on a
.
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.
Looking great! Almost there!
); | ||
return parsed.fileNames.filter( | ||
(fileName) => | ||
// only include .d.ts files. all other references should be made using `import` or `require`. |
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 think standard ts(x) files can be referenced with types in them? Can you check? Maybe it makes sense for us to not filter this at all and just take the references verbatim?
|
||
// TypeScript files can *implicitly* depend on .d.ts files. We discover | ||
// these files by extracting them from the nearest tsconfig.json file. | ||
// These do not need to be processed further since they have already been fully |
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 are sure these are absolute paths at all times?
What happens if a non-existent file is referenced, does it end up in the unresolvable set of files correctly? Did you add a test or if not, could you please?
No description provided.