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

Commit5cddb4c

Browse files
authored
feat(es/typescript): Support TS 4.9 (#5938)
**Description:**This PR adds satisfaction expression to the AST and parser.
1 parentae14211 commit5cddb4c

File tree

50 files changed

+2869
-1916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2869
-1916
lines changed
Lines changed: 25 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,26 @@
11
//// [typeSatisfaction.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 11 | const t1 = { a: 1 } satisfies I1; // Ok
6-
//! : ^^^^^^^^^
7-
//! `----
8-
//!
9-
//! x Expected a semicolon
10-
//! ,----
11-
//! 12 | const t2 = { a: 1, b: 1 } satisfies I1; // Error
12-
//! : ^^^^^^^^^
13-
//! `----
14-
//!
15-
//! x Expected a semicolon
16-
//! ,----
17-
//! 13 | const t3 = { } satisfies I1; // Error
18-
//! : ^^^^^^^^^
19-
//! `----
20-
//!
21-
//! x Expected a semicolon
22-
//! ,----
23-
//! 15 | const t4: T1 = { a: "a" } satisfies T1; // Ok
24-
//! : ^^^^^^^^^
25-
//! `----
26-
//!
27-
//! x Expected a semicolon
28-
//! ,----
29-
//! 16 | const t5 = (m => m.substring(0)) satisfies T2; // Ok
30-
//! : ^^^^^^^^^
31-
//! `----
32-
//!
33-
//! x Expected a semicolon
34-
//! ,----
35-
//! 18 | const t6 = [1, 2] satisfies [number, number];
36-
//! : ^^^^^^^^^
37-
//! `----
38-
//!
39-
//! x Expected a semicolon
40-
//! ,----
41-
//! 23 | let t7 = { a: 'test' } satisfies A;
42-
//! : ^^^^^^^^^
43-
//! `----
44-
//!
45-
//! x Expected a semicolon
46-
//! ,----
47-
//! 24 | let t8 = { a: 'test', b: 'test' } satisfies A;
48-
//! : ^^^^^^^^^
49-
//! `----
2+
vart1={
3+
a:1
4+
};// Ok
5+
vart2={
6+
a:1,
7+
b:1
8+
};// Error
9+
vart3={};// Error
10+
vart4={
11+
a:"a"
12+
};// Ok
13+
vart5=function(m){
14+
returnm.substring(0);
15+
};// Ok
16+
vart6=[
17+
1,
18+
2
19+
];
20+
vart7={
21+
a:"test"
22+
};
23+
vart8={
24+
a:"test",
25+
b:"test"
26+
};
Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1 @@
11
//// [typeSatisfaction.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 11 | const t1 = { a: 1 } satisfies I1; // Ok
6-
//! : ^^^^^^^^^
7-
//! `----
8-
//!
9-
//! x Expected a semicolon
10-
//! ,----
11-
//! 12 | const t2 = { a: 1, b: 1 } satisfies I1; // Error
12-
//! : ^^^^^^^^^
13-
//! `----
14-
//!
15-
//! x Expected a semicolon
16-
//! ,----
17-
//! 13 | const t3 = { } satisfies I1; // Error
18-
//! : ^^^^^^^^^
19-
//! `----
20-
//!
21-
//! x Expected a semicolon
22-
//! ,----
23-
//! 15 | const t4: T1 = { a: "a" } satisfies T1; // Ok
24-
//! : ^^^^^^^^^
25-
//! `----
26-
//!
27-
//! x Expected a semicolon
28-
//! ,----
29-
//! 16 | const t5 = (m => m.substring(0)) satisfies T2; // Ok
30-
//! : ^^^^^^^^^
31-
//! `----
32-
//!
33-
//! x Expected a semicolon
34-
//! ,----
35-
//! 18 | const t6 = [1, 2] satisfies [number, number];
36-
//! : ^^^^^^^^^
37-
//! `----
38-
//!
39-
//! x Expected a semicolon
40-
//! ,----
41-
//! 23 | let t7 = { a: 'test' } satisfies A;
42-
//! : ^^^^^^^^^
43-
//! `----
44-
//!
45-
//! x Expected a semicolon
46-
//! ,----
47-
//! 24 | let t8 = { a: 'test', b: 'test' } satisfies A;
48-
//! : ^^^^^^^^^
49-
//! `----
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//// [typeSatisfaction_contextualTyping1.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 6 | } satisfies Predicates;
6-
//! : ^^^^^^^^^
7-
//! `----
2+
varp={
3+
isEven:function(n){
4+
returnn%2===0;
5+
},
6+
isOdd:function(n){
7+
returnn%2===1;
8+
}
9+
};
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
//// [typeSatisfaction_contextualTyping1.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 6 | } satisfies Predicates;
6-
//! : ^^^^^^^^^
7-
//! `----
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//// [typeSatisfaction_ensureInterfaceImpl.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 11 | } satisfies Movable & Record<string, unknown>;
6-
//! : ^^^^^^^^^
7-
//! `----
2+
varcar={
3+
start:functionstart(){},
4+
move:functionmove(d){
5+
// d should be number
6+
},
7+
stop:functionstop(){}
8+
};
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
//// [typeSatisfaction_ensureInterfaceImpl.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 11 | } satisfies Movable & Record<string, unknown>;
6-
//! : ^^^^^^^^^
7-
//! `----
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
//// [/src/a.js]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 2 | var v = undefined satisfies 1;
6-
//! : ^^^^^^^^^
7-
//! `----
2+
varv=undefined;
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
//// [/src/a.js]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 2 | var v = undefined satisfies 1;
6-
//! : ^^^^^^^^^
7-
//! `----
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//// [typeSatisfaction_optionalMemberConformance.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 3 | const a = { x: 10 } satisfies Partial<Point2d>;
6-
//! : ^^^^^^^^^
7-
//! `----
2+
// Undesirable behavior today with type annotation
3+
vara={
4+
x:10
5+
};
6+
// Should OK
7+
console.log(a.x.toFixed());
8+
// Should error
9+
varp=a.y;
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//// [typeSatisfaction_optionalMemberConformance.ts]
2-
//!
3-
//! x Expected a semicolon
4-
//! ,----
5-
//! 3 | const a = { x: 10 } satisfies Partial<Point2d>;
6-
//! : ^^^^^^^^^
7-
//! `----
2+
vara={
3+
x:10
4+
};
5+
console.log(a.x.toFixed()),a.y;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp