GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: preserve getter annotation in accessor decorator metadata (#65343) · microsoft/TypeScript@fa62f87

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tsc
    • internal/transformers/tstransforms
      • typeserializer.go
    • testdata
      • baselines/reference/conformance
        • decoratorOnClassAccessor8(target=es2015).js
        • decoratorOnClassAccessor8(target=es2015).symbols
        • decoratorOnClassAccessor8(target=es2015).types
      • tests/cases/conformance/decorators/class/accessor
        • decoratorOnClassAccessor8.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tsc/internal/transformers/tstransforms/typeserializer.go‎

Copy file name to clipboardExpand all lines: tsc/internal/transformers/tstransforms/typeserializer.go
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ func getSetAccessorTypeAnnotationNode(node *ast.SetAccessorDeclaration) *ast.Nod
7777

7878
func getAccessorTypeNode(node *ast.Node, container *ast.Node) *ast.Node {
7979
accessors := ast.GetAllAccessorDeclarations(container.Members(), node)
80-
if accessors.SetAccessor != nil {
81-
return getSetAccessorTypeAnnotationNode(accessors.SetAccessor)
80+
typeNode := getSetAccessorTypeAnnotationNode(accessors.SetAccessor)
81+
if typeNode != nil {
82+
return typeNode
8283
}
8384
if accessors.GetAccessor != nil {
8485
return accessors.GetAccessor.Type
Collapse file

‎tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).js‎

Copy file name to clipboardExpand all lines: tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).js
+98-1Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,42 @@ class E {
2929

3030
class F {
3131
@dec set x(value: number) { }
32-
}
32+
}
33+
34+
class G {
35+
@dec get x(): string { return ""; }
36+
set x(value) { }
37+
}
38+
39+
class H {
40+
get x(): string { return ""; }
41+
@dec set x(value) { }
42+
}
43+
44+
class I {
45+
@dec set x(value) { }
46+
get x(): string { return ""; }
47+
}
48+
49+
class J {
50+
set x(value) { }
51+
@dec get x(): string { return ""; }
52+
}
53+
54+
class K {
55+
@dec get x(): string { return ""; }
56+
}
57+
58+
class L {
59+
@dec get x(): string { return ""; }
60+
set x(value: any) { }
61+
}
62+
63+
class M {
64+
@dec static get x(): number { return 0; }
65+
static set x(value) { }
66+
}
67+
3368

3469
//// [decoratorOnClassAccessor8.js]
3570
"use strict";
@@ -94,3 +129,65 @@ __decorate([
94129
__metadata("design:type", Number),
95130
__metadata("design:paramtypes", [Number])
96131
], F.prototype, "x", null);
132+
class G {
133+
get x() { return ""; }
134+
set x(value) { }
135+
}
136+
__decorate([
137+
dec,
138+
__metadata("design:type", String),
139+
__metadata("design:paramtypes", [Object])
140+
], G.prototype, "x", null);
141+
class H {
142+
get x() { return ""; }
143+
set x(value) { }
144+
}
145+
__decorate([
146+
dec,
147+
__metadata("design:type", String),
148+
__metadata("design:paramtypes", [Object])
149+
], H.prototype, "x", null);
150+
class I {
151+
set x(value) { }
152+
get x() { return ""; }
153+
}
154+
__decorate([
155+
dec,
156+
__metadata("design:type", String),
157+
__metadata("design:paramtypes", [Object])
158+
], I.prototype, "x", null);
159+
class J {
160+
set x(value) { }
161+
get x() { return ""; }
162+
}
163+
__decorate([
164+
dec,
165+
__metadata("design:type", String),
166+
__metadata("design:paramtypes", [Object])
167+
], J.prototype, "x", null);
168+
class K {
169+
get x() { return ""; }
170+
}
171+
__decorate([
172+
dec,
173+
__metadata("design:type", String),
174+
__metadata("design:paramtypes", [])
175+
], K.prototype, "x", null);
176+
class L {
177+
get x() { return ""; }
178+
set x(value) { }
179+
}
180+
__decorate([
181+
dec,
182+
__metadata("design:type", Object),
183+
__metadata("design:paramtypes", [Object])
184+
], L.prototype, "x", null);
185+
class M {
186+
static get x() { return 0; }
187+
static set x(value) { }
188+
}
189+
__decorate([
190+
dec,
191+
__metadata("design:type", Number),
192+
__metadata("design:paramtypes", [Object])
193+
], M, "x", null);
Collapse file

‎tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).symbols‎

Copy file name to clipboardExpand all lines: tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).symbols
+81Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,84 @@ class F {
7676
>x : Symbol(F.x, Decl(decoratorOnClassAccessor8.ts, 26, 9))
7777
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 27, 15))
7878
}
79+
80+
class G {
81+
>G : Symbol(G, Decl(decoratorOnClassAccessor8.ts, 28, 1))
82+
83+
@dec get x(): string { return ""; }
84+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
85+
>x : Symbol(G.x, Decl(decoratorOnClassAccessor8.ts, 30, 9), Decl(decoratorOnClassAccessor8.ts, 31, 39))
86+
87+
set x(value) { }
88+
>x : Symbol(G.x, Decl(decoratorOnClassAccessor8.ts, 30, 9), Decl(decoratorOnClassAccessor8.ts, 31, 39))
89+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 32, 10))
90+
}
91+
92+
class H {
93+
>H : Symbol(H, Decl(decoratorOnClassAccessor8.ts, 33, 1))
94+
95+
get x(): string { return ""; }
96+
>x : Symbol(H.x, Decl(decoratorOnClassAccessor8.ts, 35, 9), Decl(decoratorOnClassAccessor8.ts, 36, 34))
97+
98+
@dec set x(value) { }
99+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
100+
>x : Symbol(H.x, Decl(decoratorOnClassAccessor8.ts, 35, 9), Decl(decoratorOnClassAccessor8.ts, 36, 34))
101+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 37, 15))
102+
}
103+
104+
class I {
105+
>I : Symbol(I, Decl(decoratorOnClassAccessor8.ts, 38, 1))
106+
107+
@dec set x(value) { }
108+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
109+
>x : Symbol(I.x, Decl(decoratorOnClassAccessor8.ts, 40, 9), Decl(decoratorOnClassAccessor8.ts, 41, 25))
110+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 41, 15))
111+
112+
get x(): string { return ""; }
113+
>x : Symbol(I.x, Decl(decoratorOnClassAccessor8.ts, 40, 9), Decl(decoratorOnClassAccessor8.ts, 41, 25))
114+
}
115+
116+
class J {
117+
>J : Symbol(J, Decl(decoratorOnClassAccessor8.ts, 43, 1))
118+
119+
set x(value) { }
120+
>x : Symbol(J.x, Decl(decoratorOnClassAccessor8.ts, 45, 9), Decl(decoratorOnClassAccessor8.ts, 46, 20))
121+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 46, 10))
122+
123+
@dec get x(): string { return ""; }
124+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
125+
>x : Symbol(J.x, Decl(decoratorOnClassAccessor8.ts, 45, 9), Decl(decoratorOnClassAccessor8.ts, 46, 20))
126+
}
127+
128+
class K {
129+
>K : Symbol(K, Decl(decoratorOnClassAccessor8.ts, 48, 1))
130+
131+
@dec get x(): string { return ""; }
132+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
133+
>x : Symbol(K.x, Decl(decoratorOnClassAccessor8.ts, 50, 9))
134+
}
135+
136+
class L {
137+
>L : Symbol(L, Decl(decoratorOnClassAccessor8.ts, 52, 1))
138+
139+
@dec get x(): string { return ""; }
140+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
141+
>x : Symbol(L.x, Decl(decoratorOnClassAccessor8.ts, 54, 9), Decl(decoratorOnClassAccessor8.ts, 55, 39))
142+
143+
set x(value: any) { }
144+
>x : Symbol(L.x, Decl(decoratorOnClassAccessor8.ts, 54, 9), Decl(decoratorOnClassAccessor8.ts, 55, 39))
145+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 56, 10))
146+
}
147+
148+
class M {
149+
>M : Symbol(M, Decl(decoratorOnClassAccessor8.ts, 57, 1))
150+
151+
@dec static get x(): number { return 0; }
152+
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
153+
>x : Symbol(M.x, Decl(decoratorOnClassAccessor8.ts, 59, 9), Decl(decoratorOnClassAccessor8.ts, 60, 45))
154+
155+
static set x(value) { }
156+
>x : Symbol(M.x, Decl(decoratorOnClassAccessor8.ts, 59, 9), Decl(decoratorOnClassAccessor8.ts, 60, 45))
157+
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 61, 17))
158+
}
159+
Collapse file

‎tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).types‎

Copy file name to clipboardExpand all lines: tsc/testdata/baselines/reference/conformance/decoratorOnClassAccessor8(target=es2015).types
+88Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,91 @@ class F {
7676
>x : number
7777
>value : number
7878
}
79+
80+
class G {
81+
>G : G
82+
83+
@dec get x(): string { return ""; }
84+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
85+
>x : string
86+
>"" : ""
87+
88+
set x(value) { }
89+
>x : string
90+
>value : string
91+
}
92+
93+
class H {
94+
>H : H
95+
96+
get x(): string { return ""; }
97+
>x : string
98+
>"" : ""
99+
100+
@dec set x(value) { }
101+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
102+
>x : string
103+
>value : string
104+
}
105+
106+
class I {
107+
>I : I
108+
109+
@dec set x(value) { }
110+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
111+
>x : string
112+
>value : string
113+
114+
get x(): string { return ""; }
115+
>x : string
116+
>"" : ""
117+
}
118+
119+
class J {
120+
>J : J
121+
122+
set x(value) { }
123+
>x : string
124+
>value : string
125+
126+
@dec get x(): string { return ""; }
127+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
128+
>x : string
129+
>"" : ""
130+
}
131+
132+
class K {
133+
>K : K
134+
135+
@dec get x(): string { return ""; }
136+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
137+
>x : string
138+
>"" : ""
139+
}
140+
141+
class L {
142+
>L : L
143+
144+
@dec get x(): string { return ""; }
145+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
146+
>x : string
147+
>"" : ""
148+
149+
set x(value: any) { }
150+
>x : string
151+
>value : any
152+
}
153+
154+
class M {
155+
>M : M
156+
157+
@dec static get x(): number { return 0; }
158+
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
159+
>x : number
160+
>0 : 0
161+
162+
static set x(value) { }
163+
>x : number
164+
>value : number
165+
}
166+
Collapse file

‎tsc/testdata/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts‎

Copy file name to clipboardExpand all lines: tsc/testdata/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts
+35-1Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,38 @@ class E {
2929

3030
class F {
3131
@dec set x(value: number) { }
32-
}
32+
}
33+
34+
class G {
35+
@dec get x(): string { return ""; }
36+
set x(value) { }
37+
}
38+
39+
class H {
40+
get x(): string { return ""; }
41+
@dec set x(value) { }
42+
}
43+
44+
class I {
45+
@dec set x(value) { }
46+
get x(): string { return ""; }
47+
}
48+
49+
class J {
50+
set x(value) { }
51+
@dec get x(): string { return ""; }
52+
}
53+
54+
class K {
55+
@dec get x(): string { return ""; }
56+
}
57+
58+
class L {
59+
@dec get x(): string { return ""; }
60+
set x(value: any) { }
61+
}
62+
63+
class M {
64+
@dec static get x(): number { return 0; }
65+
static set x(value) { }
66+
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.