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

Fix: Missing parameter properties info in constructors (fixes #143) #168

Merged
merged 1 commit into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions lib/ast-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1187,10 +1187,27 @@ module.exports = function(ast, extra) {
id: null,
params: node.parameters.map(function(param) {
var convertedParam = convertChild(param);
convertedParam.decorators = (param.decorators) ? param.decorators.map(function(d) {
var decorators = (param.decorators) ? param.decorators.map(function(d) {
return convertChild(d.expression);
}) : [];
return convertedParam;

if (param.modifiers) {
return {
type: "TSParameterProperty",
range: [param.getStart(), param.end],
loc: getLoc(param, ast),
accessibility: getTSNodeAccessibility(param),
isReadonly: param.modifiers.some(function(modifier) {
return modifier.kind === SyntaxKind.ReadonlyKeyword;
}),
parameter: convertedParam,
decorators: decorators
};
}

return assign(convertedParam, {
decorators: decorators
});
}),
generator: false,
expression: false,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Foo {
constructor(private firstName: string,
private readonly lastName: string,
private age: number = 30,
private readonly student: boolean = false) {}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Foo {
constructor(protected firstName: string,
protected readonly lastName: string,
protected age: number = 30,
protected readonly student: boolean = false) {}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Foo {
constructor(public firstName: string,
public readonly lastName: string,
public age: number = 30,
public readonly student: boolean = false) {}
}
Loading