Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TypeScript 4.1 Syntax Support #2583

Closed
Assignees
bradzacher
Labels
ASTPRs and Issues about the AST structureNew TypeScript VersiondependenciesIssue about dependencies of the packagehas prthere is a PR raised to close thispackage: scope-managerIssues related to @typescript-eslint/scope-managerpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree
@bradzacher

Description

@bradzacher

https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/

This issue is just to track all of the new features and their implementation state in this project.
As with all releases, we will not necessarily to support all features until closer to the full release when everything the features are stabilised.
Please be patient.


Template Literal Types

typeWorld="world";typeGreeting= `hello ${World}`;//typeColor="red"|"blue";typeQuantity="one"|"two";typeSeussFish= `${Quantity|Color} fish`;//typeVerticalAlignment="top"|"middle"|"bottom";typeHorizontalAlignment="left"|"center"|"right";// Takes//   | "top-left"    | "top-center"    | "top-right"//   | "middle-left" | "middle-center" | "middle-right"//   | "bottom-left" | "bottom-center" | "bottom-right"declarefunctionsetAlignment(value: `${VerticalAlignment}-${HorizontalAlignment}`):void;typeEnthusiasticGreeting<Textendsstring>= `${Uppercase<T>} - ${Lowercase<T>} - ${Capitalize<T>} - ${Uncapitalize<T>}`;typeHELLO=EnthusiasticGreeting<"heLLo">;// same as//   type HELLO = "HELLO - hello - Hello - heLLo";

This will require new AST nodes.

Key Remapping in Mapped Types

typeMappedTypeWithNewKeys<T>={[KinkeyofTasNewKeyType]:T[K]//            ^^^^^^^^^^^^^//            This is the new syntax!}

This will require AST changes.

Recursive Conditional Types

typeAwaited<T>=TextendsPromiseLike<inferU> ?Awaited<U> :T;

This will require no changes.

Pedantic Index Signature Checks

Example with thenoUncheckedIndexedAccess compiler option turned on:

functionscreamLines(strs:string[]){// this will have issuesfor(leti=0;i<strs.length;i++){console.log(strs[i].toUpperCase());//          ~~~~~~~// error! Object is possibly 'undefined'.}}

This will require no changes (it will just start working and improve existing rules likeno-unnecessary-condition for free!)

React 17 JSX Factories

This will require a slight tweak to how theparser passes options toscope-manager


Other changes that have no impact on us:

Metadata

Metadata

Assignees

Labels

ASTPRs and Issues about the AST structureNew TypeScript VersiondependenciesIssue about dependencies of the packagehas prthere is a PR raised to close thispackage: scope-managerIssues related to @typescript-eslint/scope-managerpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp