Feedback: 5.0 deprecations
See original GitHub issueIn 5.0, we’ve marked the following configurations as deprecated:
target: ES3
noImplicitUseStrict
keyofStringsOnly
suppressExcessPropertyErrors
suppressImplicitAnyIndexErrors
noStrictGenericChecks
charset
out
These configurations will continue to “work” until TypeScript 5.5, at which point they will be removed entirely. In TypeScript 5.0, 5.1, 5.2, 5.3, and 5.4, you can specify ignoreDeprecations: "5.0"
to silence this warning.
What should I use instead?
target: ES3
ES3 runtimes are nearly 100% extinct, so we’re removing support for this as an emit target. Use target: ES5
as the next-closest thing along with a linter to detect any potentially-problematic ES3 constructs, or use target: ESNext
and use a different downleveling emitter.
noImplicitUseStrict
This flag disables emitting a "use strict";
prologue at the top of module bodies when the target is not implicitly a module. This can lead to unexpected behavior since there are subtle behavioral differences between strict and nonstrict mode. Fix: Remove any reliance on nonstrict behavior.
keyofStringsOnly
This flag removes symbol
-based keys from the keyof T
type operator. This can lead to unexpected type errors when code relying on this flag interacts with code that doesn’t. Fix: Use string & keyof T
to filter keys to those with string
types.
suppressExcessPropertyErrors
This flag disables excess property checking. This can lead to unexpected program behavior when an optional property name is misspelled, since no error is issued. Fix: use a type assertion to silence this in cases where you really do want an optional property, or fix the target type.
suppressImplicitAnyIndexErrors
This flag disables the error produced when indexing an object which doesn’t support indexing. This was always intended to be a temporary flag, so is going away. Fix: Add an index signature to the relevant type (or use a type assertion at the indexing location).
noStrictGenericChecks
This flag disables certain checks relating the constraints of generic types, which can lead to undesirable unsound behavior. Fix: Correct the types, or use a type assertion.
charset
This flag hasn’t done anything for a very long time. Fix: Remove it from your config file
out
This flag for emitting a single file from a set of nonmodule inputs incorrectly relied on the current working directory to compute the output filename, leading to unexpected problems when tsc
was invoked programmatically or from a different directory. Fix: use outFile
instead.
Feedback?
We believe we’ve picked a fairly conservative set of options to deprecate in this release. If these deprecations are overly burdensome for your codebase, we’d like to understand why - please let us know!
Search terms: Flag is deprecated and will stop functioning in TypeScript 5.5. Specify ignoreDeprecations: 5.0 to silence this error
Issue Analytics
- State:
- Created 9 months ago
- Reactions:6
- Comments:6 (2 by maintainers)
Top GitHub Comments
thanks, this was the part I was missing.
Yes