Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit c4b0b64

Browse files
soda0289JamesHenry
authored andcommitted
Fix: Label readonly class properties (fixes #302) (#303)
1 parent bffd6cc commit c4b0b64

File tree

68 files changed

+8445
-7694
lines changed

Some content is hidden

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

68 files changed

+8445
-7694
lines changed

lib/convert.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ module.exports = function convert(config) {
678678
computed: nodeUtils.isComputedProperty(node.name),
679679
static: nodeUtils.hasStaticModifierFlag(node),
680680
accessibility: nodeUtils.getTSNodeAccessibility(node),
681+
readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node),
681682
decorators: convertDecorators(node.decorators),
682683
typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null
683684
});

tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -160,58 +160,58 @@ module.exports = {
160160
"name": "Promise"
161161
},
162162
"typeParameters": {
163+
"type": "TypeParameterInstantiation",
164+
"range": [
165+
75,
166+
83
167+
],
163168
"loc": {
164-
"end": {
165-
"column": 44,
166-
"line": 2
167-
},
168169
"start": {
169-
"column": 36,
170-
"line": 2
170+
"line": 2,
171+
"column": 36
172+
},
173+
"end": {
174+
"line": 2,
175+
"column": 44
171176
}
172177
},
173178
"params": [
174179
{
175-
"id": {
176-
"loc": {
177-
"end": {
178-
"column": 43,
179-
"line": 2
180-
},
181-
"start": {
182-
"column": 37,
183-
"line": 2
184-
}
180+
"type": "GenericTypeAnnotation",
181+
"range": [
182+
76,
183+
82
184+
],
185+
"loc": {
186+
"start": {
187+
"line": 2,
188+
"column": 37
185189
},
190+
"end": {
191+
"line": 2,
192+
"column": 43
193+
}
194+
},
195+
"id": {
196+
"type": "TSStringKeyword",
186197
"range": [
187198
76,
188199
82
189200
],
190-
"type": "TSStringKeyword"
191-
},
192-
"loc": {
193-
"end": {
194-
"column": 43,
195-
"line": 2
196-
},
197-
"start": {
198-
"column": 37,
199-
"line": 2
201+
"loc": {
202+
"start": {
203+
"line": 2,
204+
"column": 37
205+
},
206+
"end": {
207+
"line": 2,
208+
"column": 43
209+
}
200210
}
201211
},
202-
"range": [
203-
76,
204-
82
205-
],
206-
"type": "GenericTypeAnnotation",
207212
"typeParameters": null
208213
}
209-
],
210-
"range": [
211-
75,
212-
83
213-
],
214-
"type": "TypeParameterInstantiation"
214+
]
215215
}
216216
}
217217
},
@@ -552,4 +552,4 @@ module.exports = {
552552
}
553553
}
554554
]
555-
};
555+
};

tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ module.exports = {
9090
"computed": false,
9191
"static": false,
9292
"accessibility": null,
93+
"readonly": false,
9394
"decorators": [],
9495
"typeAnnotation": null
9596
},
@@ -149,6 +150,7 @@ module.exports = {
149150
"computed": false,
150151
"static": false,
151152
"accessibility": null,
153+
"readonly": false,
152154
"decorators": [],
153155
"typeAnnotation": null
154156
}
@@ -410,4 +412,4 @@ module.exports = {
410412
}
411413
}
412414
]
413-
};
415+
};

0 commit comments

Comments
 (0)