Feedback: 5.0 deprecations · Issue #51909 · microsoft/TypeScript (original) (raw)

See also #51000 / #51424

In 5.0, we've marked the following configurations as deprecated:

These configurations will continue to "work" until TypeScript 5.5, at which point they will be removed entirely. In TypeScript 4.9.5+, 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.

Fix: 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.

prepend in project references

This setting allowed for upstream project reference outputs to be prepended to the current project's output files. Had we not needed this ourselves back in 3.0, we likely wouldn't have added it in the first place, and it hasn't seen wide adoption.

Fix: Use a single tsconfig to create output bundles, or use an external bundler on the outputs.

Implicitly OS-specific newLine

The newLine setting controls the line endings used in emitted files. If not specified, in TypeScript 4.9, this would default to the operating system's idiomatic newline (CR LF for Windows, LF for everyone else). Since all modern dev tools support LF endings without issue, we're removing this behavior to increase build predictability, and the new default is LF.

Fix: Pick one or the other, or use a tool after-the-fact to change outputs to the current OS's if this is really desired

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