-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback: 5.0 deprecations #51909
Comments
If |
TIL this flag exists |
So the issue is that if you have the input code export function fn() {
if (this === undefined) {
console.log('called free');
} else {
console.log('called bound');
}
}
fn();
({ fn }).fn(); Per spec, this must print "called free, called bound", because all module code is in strict mode, and this must be a module file (it has a top-level To clarify, this doesn't change any behavior when the input file is not a module. |
thanks, this was the part I was missing. |
Will any-indexing still be allowed when |
Yes |
Personally I find the default behaviour of Similarly I think |
That's good feedback, I'll raise it as a possibility |
The list is missing As a general feedback, I'm having a headache currently how to make the deprecations go away in a backwards-compatible way. For context, in SvelteKit we're creating a generated |
I'm sympathetic and we might want to ship a 4.9 patch release to allow |
That's true, it never was legal before, but it also never occured before that a flag became deprecated and resulted in an error, so you were able to use your unchanged tsconfig across (major) versions. |
Yep, good point. We've merged #52419 so will ship a patch release of 4.9 shortly that will allow specifying |
What specific changes need to be made to a tsconfig.json file to include the output of a project reference in an outputted file? My .tsconfig for example currently looks like this:
|
The functionality is going away entirely. You look into something like rollup, parcel, or just straight concatenation with a script. Side observation: to be honest, using |
Well that's quite a badge of honour to be told I've been doing it wrong successfully for about seven years! 😲 I've got a custom development process where I clone various repositories (I.E. my libraries) into a sort of workspace and combine them into a single .js file for local testing, and deployment onto the web, often as SPAs which are essentially games oriented around a canvas HTML object. Just out of interest, what is the typical way a developer should be going about this? As in, to clone multiple repositories (where one of them is the app itself) and build them all and combine them all together for local testing and deployment? I understand that there are various options but obviously after your comment I'm keen to finally understand what a normal person would do! |
Just to add, in case it makes it more obvious what I'm talking about, I had been approacing software development with TypeScript having come from a background of working in C# and Visual Studio, so my development process is as if I am creating a solution consisting of multiple projects which have been included in the solution and then when I build it produces a single executable. |
Maybe it would also be good to switch the default |
📰: TypeScript 4.9.5 is now out, which allows specifying |
Still not online at |
Weird - the deploy timed out for just the NuGet build. 4.9.5 should be out on NuGet as well now! |
@frost-cy Hello! Will there be a "google feedback" ticket for 5.0? Sorry for a ping. |
@polkovnikov-ph yes, @mhausner is working on it. |
I find that quite dangerous, since I wandered here, as we have a lot of lines that should ideally look like: So some of the safer but quite verbose alternatives are:
I was wondering if |
Perhaps, but all the cast is doing is making explicit what would otherwise have been an implicit cast that was suppressed by the now deprecated I think that if |
ES3 happens to be the version under which you will be scripting Adobe After Effects |
ExtendScript by Adobe is an Extension of ES3 |
As of Version 16, which came out 6 years ago, the After Effects scripting engine has moved to ES2018. The ExtendScript version is considered legacy. |
@dummdidumm I've added those to the list for anyone else reading. |
* dependency update * @babel/core: 7.21.3 * @types/jest: 29.5.0 * dependency-cruiser: 12.10.1 * jsdom: 21.1.1 * rimraf: 4.4.0 * typedoc: 0.23.27 * typescript: 5.0.2 * Deprecated flag charset no longer used - see microsoft/TypeScript#51909 * deprecated attribute see: * https://www.typescriptlang.org/tsconfig#suppressImplicitAnyIndexErrors * microsoft/TypeScript#51000 * types to be explicitly considered while other types not included * new dev dependency to remove @types usage confusion during transpilation * current lock file
See also #51000 / #51424
In 5.0, we've marked the following configurations as deprecated:
target: ES3
importsNotUsedAsValues
noImplicitUseStrict
keyofStringsOnly
preserveValueImports
suppressExcessPropertyErrors
suppressImplicitAnyIndexErrors
noStrictGenericChecks
charset
out
prepend
in project referencesnewLine
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 usetarget: 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 thekeyof 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 withstring
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 referencesThis 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
The text was updated successfully, but these errors were encountered: