Microsoft has updated TypeScript to version 4.2 and a flag has been added to answer the age-old question: "just why is that file there?"
--explainFiles flag to force the TypeScript compiler to explain itself after files that a developer had hit with
exclude still turn up in a program.
More than once we've scratched our heads and wondered exactly why certain files persist in turning up. "Inferring the files of your program," explained Microsoft, "turns out to be a complicated process."
Indeed it does and, while the new flag is welcome, the output format (which you'll probably want to pipe somewhere) is a little dense and "might change over time."
Program manager for TypeScript Daniel Rosenwasser also highlighted other improvements, including type aliases, stricter check for the
in operator and
abstract construct signatures. In addition, improvements were made around uncalled function checks in logical expressions (which now apply within
|| expressions) and changes around string index signatures.
In terms of breaking changes there are the usual tweaks to
lib.d.ts to catch out the unwary (Rosenwasser highlighted changes to
ResizeObserver as potentially being the most disruptive.) The triggering of an error for import paths with a
.d.ts might also cause a few problems, as could the different type now needed for the
lift callback in