babel-generator: Add TypeScript support (#5896)

* babel-generator: Add TypeScript support

* Remove type declarations; not published from babylon

* Remove TODOs

* Consistently use `this.word` for tokens that are words
This commit is contained in:
Andy 2017-07-28 13:07:05 -07:00 committed by Henry Zhu
parent f83c83d49c
commit c1d07fd6db
284 changed files with 1450 additions and 51 deletions

View File

@ -8,6 +8,16 @@ export function ClassDeclaration(node: Object, parent: Object) {
this.printJoin(node.decorators, node);
}
if (node.declare) {
this.word("declare");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
this.word("class");
if (node.id) {
@ -59,10 +69,22 @@ export function ClassBody(node: Object) {
export function ClassProperty(node: Object) {
this.printJoin(node.decorators, node);
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (node.readonly) {
this.word("readonly");
this.space();
}
if (node.computed) {
this.token("[");
this.print(node.key, node);
@ -71,6 +93,11 @@ export function ClassProperty(node: Object) {
this._variance(node);
this.print(node.key, node);
}
if (node.optional) {
this.token("?");
}
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
@ -82,12 +109,28 @@ export function ClassProperty(node: Object) {
}
export function ClassMethod(node: Object) {
this._classMethodHead(node);
this.space();
this.print(node.body, node);
}
export function _classMethodHead(node) {
this.printJoin(node.decorators, node);
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
this._method(node);
this._methodHead(node);
}

View File

@ -65,6 +65,8 @@ export function NewExpression(node: Object, parent: Object) {
return;
}
this.print(node.typeParameters, node);
if (node.optional) {
this.token("?.");
}
@ -94,6 +96,8 @@ export function Decorator(node: Object) {
export function CallExpression(node: Object) {
this.print(node.callee, node);
this.print(node.typeParameters, node);
if (node.optional) {
this.token("?.");
}

View File

@ -303,38 +303,6 @@ export function TypeAlias(node: Object) {
this.semicolon();
}
export function TypeAnnotation(node: Object) {
this.token(":");
this.space();
if (node.optional) this.token("?");
this.print(node.typeAnnotation, node);
}
export function TypeParameter(node: Object) {
this._variance(node);
this.word(node.name);
if (node.bound) {
this.print(node.bound, node);
}
if (node.default) {
this.space();
this.token("=");
this.space();
this.print(node.default, node);
}
}
export function TypeParameterInstantiation(node: Object) {
this.token("<");
this.printList(node.params, node, {});
this.token(">");
}
export { TypeParameterInstantiation as TypeParameterDeclaration };
export function ObjectTypeAnnotation(node: Object) {
if (node.exact) {
this.token("{|");

View File

@ -8,3 +8,5 @@ export * from "./types";
export * from "./flow";
export * from "./base";
export * from "./jsx";
export * from "./tsFlowCommon";
export * from "./typescript";

View File

@ -3,20 +3,31 @@ import * as t from "babel-types";
export function _params(node: Object) {
this.print(node.typeParameters, node);
this.token("(");
this.printList(node.params, node, {
iterator: node => {
if (node.optional) this.token("?");
this.print(node.typeAnnotation, node);
},
});
this._parameters(node.params, node);
this.token(")");
if (node.returnType) {
this.print(node.returnType, node);
this.print(node.returnType, node);
}
export function _parameters(parameters, parent) {
for (let i = 0; i < parameters.length; i++) {
this._param(parameters[i], parent);
if (i < parameters.length - 1) {
this.token(",");
this.space();
}
}
}
export function _method(node: Object) {
export function _param(parameter, parent) {
this.printJoin(parameter.decorators, parameter);
this.print(parameter, parent);
if (parameter.optional) this.token("?");
this.print(parameter.typeAnnotation, parameter);
}
export function _methodHead(node: Object) {
const kind = node.kind;
const key = node.key;
@ -44,9 +55,11 @@ export function _method(node: Object) {
this.print(key, node);
}
if (node.optional) {
this.token("?");
}
this._params(node);
this.space();
this.print(node.body, node);
}
export function _predicate(node: Object) {
@ -59,7 +72,7 @@ export function _predicate(node: Object) {
}
}
export function FunctionExpression(node: Object) {
export function _functionHead(node: Object) {
if (node.async) {
this.word("async");
this.space();
@ -67,16 +80,17 @@ export function FunctionExpression(node: Object) {
this.word("function");
if (node.generator) this.token("*");
this.space();
if (node.id) {
this.space();
this.print(node.id, node);
} else {
this.space();
}
this._params(node);
this._predicate(node);
}
export function FunctionExpression(node: Object) {
this._functionHead(node);
this.space();
this.print(node.body, node);
}

View File

@ -236,6 +236,11 @@ function constDeclarationIndent() {
}
export function VariableDeclaration(node: Object, parent: Object) {
if (node.declare) {
this.word("declare");
this.space();
}
this.word(node.kind);
this.space();

View File

@ -0,0 +1,38 @@
export function TypeAnnotation(node) {
this.token(":");
this.space();
if (node.optional) this.token("?");
this.print(node.typeAnnotation, node);
}
export function TypeParameterInstantiation(node): void {
this.token("<");
this.printList(node.params, node, {});
this.token(">");
}
export { TypeParameterInstantiation as TypeParameterDeclaration };
export function TypeParameter(node) {
this._variance(node);
this.word(node.name);
if (node.bound) {
this.print(node.bound, node);
}
if (node.constraint) {
this.space();
this.word("extends");
this.space();
this.print(node.constraint, node);
}
if (node.default) {
this.space();
this.token("=");
this.space();
this.print(node.default, node);
}
}

View File

@ -31,7 +31,9 @@ export { ObjectExpression as ObjectPattern };
export function ObjectMethod(node: Object) {
this.printJoin(node.decorators, node);
this._method(node);
this._methodHead(node);
this.space();
this.print(node.body, node);
}
export function ObjectProperty(node: Object) {

View File

@ -0,0 +1,456 @@
export function TSParameterProperty(node) {
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.readonly) {
this.word("readonly");
this.space();
}
this._param(node.parameter);
}
export function TSDeclareFunction(node) {
if (node.declare) {
this.word("declare");
this.space();
}
this._functionHead(node);
this.token(";");
}
export function TSDeclareMethod(node) {
this._classMethodHead(node);
this.token(";");
}
export function TSQualifiedName(node) {
this.print(node.left, node);
this.token(".");
this.print(node.right, node);
}
export function TSCallSignatureDeclaration(node) {
this.tsPrintSignatureDeclarationBase(node);
}
export function TSConstructSignatureDeclaration(node) {
this.word("new");
this.space();
this.tsPrintSignatureDeclarationBase(node);
}
export function TSPropertySignature(node) {
const { readonly, initializer } = node;
if (readonly) {
this.word("readonly");
this.space();
}
this.tsPrintPropertyOrMethodName(node);
this.print(node.typeAnnotation, node);
if (initializer) {
this.space();
this.token("=");
this.space();
this.print(initializer, node);
}
this.token(";");
}
export function tsPrintPropertyOrMethodName(node) {
if (node.computed) {
this.token("[");
}
this.print(node.key, node);
if (node.computed) {
this.token("]");
}
if (node.optional) {
this.token("?");
}
}
export function TSMethodSignature(node) {
this.tsPrintPropertyOrMethodName(node);
this.tsPrintSignatureDeclarationBase(node);
this.token(";");
}
export function TSIndexSignature(node) {
const { readonly } = node;
if (readonly) {
this.word("readonly");
this.space();
}
this.token("[");
this._parameters(node.parameters, node);
this.token("]");
this.print(node.typeAnnotation, node);
this.token(";");
}
export function TSAnyKeyword() {
this.word("any");
}
export function TSNumberKeyword() {
this.word("number");
}
export function TSObjectKeyword() {
this.word("object");
}
export function TSBooleanKeyword() {
this.word("boolean");
}
export function TSStringKeyword() {
this.word("string");
}
export function TSSymbolKeyword() {
this.word("symbol");
}
export function TSVoidKeyword() {
this.word("void");
}
export function TSUndefinedKeyword() {
this.word("undefined");
}
export function TSNullKeyword() {
this.word("null");
}
export function TSNeverKeyword() {
this.word("never");
}
export function TSThisType() {
this.word("this");
}
export function TSFunctionType(node) {
this.tsPrintFunctionOrConstructorType(node);
}
export function TSConstructorType(node) {
this.word("new");
this.space();
this.tsPrintFunctionOrConstructorType(node);
}
export function tsPrintFunctionOrConstructorType(
node: FunctionOrConstructorType,
) {
const { typeParameters, parameters } = node;
this.print(typeParameters, node);
this.token("(");
this._parameters(parameters, node);
this.token(")");
this.space();
this.token("=>");
this.space();
this.print(node.typeAnnotation.typeAnnotation, node);
}
export function TSTypeReference(node) {
this.print(node.typeName, node);
this.print(node.typeParameters, node);
}
export function TSTypePredicate(node) {
this.print(node.parameterName);
this.space();
this.word("is");
this.space();
this.print(node.typeAnnotation.typeAnnotation);
}
export function TSTypeQuery(node) {
this.word("typeof");
this.space();
this.print(node.exprName);
}
export function TSTypeLiteral(node) {
this.tsPrintTypeLiteralOrInterfaceBody(node.members, node);
}
export function tsPrintTypeLiteralOrInterfaceBody(members, node) {
this.tsPrintBraced(members, node);
}
export function tsPrintBraced(members, node) {
this.token("{");
if (members.length) {
this.indent();
this.newline();
for (const member of members) {
this.print(member, node);
//this.token(sep);
this.newline();
}
this.dedent();
this.rightBrace();
} else {
this.token("}");
}
}
export function TSArrayType(node) {
this.print(node.elementType);
this.token("[]");
}
export function TSTupleType(node) {
this.token("[");
this.printList(node.elementTypes, node);
this.token("]");
}
export function TSUnionType(node) {
this.tsPrintUnionOrIntersectionType(node, "|");
}
export function TSIntersectionType(node) {
this.tsPrintUnionOrIntersectionType(node, "&");
}
export function tsPrintUnionOrIntersectionType(node, sep) {
this.printJoin(node.types, node, {
separator() {
this.space();
this.token(sep);
this.space();
},
});
}
export function TSParenthesizedType(node) {
this.token("(");
this.print(node.typeAnnotation, node);
this.token(")");
}
export function TSTypeOperator(node) {
this.token(node.operator);
this.space();
this.print(node.typeAnnotation, node);
}
export function TSIndexedAccessType(node) {
this.print(node.objectType, node);
this.token("[");
this.print(node.indexType, node);
this.token("]");
}
export function TSMappedType(node) {
const { readonly, typeParameter, optional } = node;
this.token("{");
this.space();
if (readonly) {
this.word("readonly");
this.space();
}
this.token("[");
this.word(typeParameter.name);
this.space();
this.word("in");
this.space();
this.print(typeParameter.constraint, typeParameter);
this.token("]");
if (optional) {
this.token("?");
}
this.token(":");
this.space();
this.print(node.typeAnnotation, node);
this.space();
this.token("}");
}
export function TSLiteralType(node) {
this.print(node.literal, node);
}
export function TSExpressionWithTypeArguments(node) {
this.print(node.expression, node);
this.print(node.typeParameters, node);
}
export function TSInterfaceDeclaration(node) {
const { declare, id, typeParameters, extends: extendz, body } = node;
if (declare) {
this.word("declare");
this.space();
}
this.word("interface");
this.space();
this.print(id, node);
this.print(typeParameters, node);
if (extendz) {
this.space();
this.word("extends");
this.space();
this.printList(extendz, node);
}
this.space();
this.print(body, node);
}
export function TSInterfaceBody(node) {
this.tsPrintTypeLiteralOrInterfaceBody(node.body, node);
}
export function TSTypeAliasDeclaration(node) {
const { declare, id, typeParameters, typeAnnotation } = node;
if (declare) {
this.word("declare");
this.space();
}
this.word("type");
this.space();
this.print(id, node);
this.print(typeParameters, node);
this.space();
this.token("=");
this.space();
this.print(typeAnnotation, node);
this.token(";");
}
export function TSAsExpression(node) {
const { expression, typeAnnotation } = node;
this.print(expression, node);
this.space();
this.word("as");
this.space();
this.print(typeAnnotation, node);
}
export function TSTypeAssertion(node) {
const { typeAnnotation, expression } = node;
this.token("<");
this.print(typeAnnotation, node);
this.token(">");
this.space();
this.print(expression, node);
}
export function TSEnumDeclaration(node) {
const { declare, const: isConst, id, members } = node;
if (declare) {
this.word("declare");
this.space();
}
if (isConst) {
this.word("const");
this.space();
}
this.word("enum");
this.space();
this.print(id, node);
this.space();
this.tsPrintBraced(members, node);
}
export function TSEnumMember(node) {
const { id, initializer } = node;
this.print(id, node);
if (initializer) {
this.space();
this.token("=");
this.space();
this.print(initializer, node);
}
this.token(",");
}
export function TSModuleDeclaration(node) {
const { declare, id } = node;
if (declare) {
this.word("declare");
this.space();
}
if (!node.global) {
this.word(id.type === "Identifier" ? "namespace" : "module");
this.space();
}
this.print(id, node);
if (!node.body) {
this.token(";");
return;
}
let body = node.body;
while (body.type === "TSModuleDeclaration") {
this.token(".");
this.print(body.id, body);
body = body.body;
}
this.space();
this.print(body, node);
}
export function TSModuleBlock(node) {
this.tsPrintBraced(node.body, node);
}
export function TSImportEqualsDeclaration(node) {
const { isExport, id, moduleReference } = node;
if (isExport) {
this.word("export");
this.space();
}
this.word("import");
this.space();
this.print(id, node);
this.space();
this.token("=");
this.space();
this.print(moduleReference, node);
this.token(";");
}
export function TSExternalModuleReference(node) {
this.token("require(");
this.print(node.expression, node);
this.token(")");
}
export function TSNonNullExpression(node) {
this.print(node.expression, node);
this.token("!");
}
export function TSExportAssignment(node) {
this.word("export");
this.space();
this.token("=");
this.space();
this.print(node.expression, node);
this.token(";");
}
export function TSNamespaceExportDeclaration(node) {
this.word("export");
this.space();
this.word("as");
this.space();
this.word("namespace");
this.space();
this.print(node.id, node);
}
export function tsPrintSignatureDeclarationBase(node) {
const { typeParameters, parameters } = node;
this.print(typeParameters, node);
this.token("(");
this._parameters(parameters, node);
this.token(")");
this.print(node.typeAnnotation, node);
}

View File

@ -93,6 +93,14 @@ export function Binary(node: Object, parent: Object): boolean {
return false;
}
export function TSAsExpression() {
return true;
}
export function TSTypeAssertion() {
return true;
}
export function BinaryExpression(node: Object, parent: Object): boolean {
// let i = (1 in []);
// for ((1 in []);;);
@ -173,7 +181,9 @@ export function ConditionalExpression(node: Object, parent: Object): boolean {
t.isBinary(parent) ||
t.isConditionalExpression(parent, { test: node }) ||
t.isAwaitExpression(parent) ||
t.isTaggedTemplateExpression(parent)
t.isTaggedTemplateExpression(parent) ||
t.isTSTypeAssertion(parent) ||
t.isTSAsExpression(parent)
) {
return true;
}

View File

@ -0,0 +1 @@
(x: number): number => x;

View File

@ -0,0 +1 @@
(x: number): number => x;

View File

@ -0,0 +1,2 @@
async < 1;
async<T>() == 0;

View File

@ -0,0 +1,2 @@
async < 1;
async<T>() == 0;

View File

@ -0,0 +1 @@
async <T>(a: T): T => a;

View File

@ -0,0 +1 @@
async <T>(a: T): T => a;

View File

@ -0,0 +1 @@
async (x?: number): any => x;

View File

@ -0,0 +1 @@
async (x?: number): any => x;

View File

@ -0,0 +1 @@
(x: number = 0) => 0;

View File

@ -0,0 +1 @@
(x: number = 0) => 0;

View File

@ -0,0 +1 @@
({ a = 0 }) => 0;

View File

@ -0,0 +1,3 @@
({
a = 0
}) => 0;

View File

@ -0,0 +1,2 @@
// Same as `generic`. Verify that JSX doesn't change things.
<T>(a: T): T => a;

View File

@ -0,0 +1,2 @@
// Same as `generic`. Verify that JSX doesn't change things.
<T>(a: T): T => a;

View File

@ -0,0 +1,3 @@
{
"plugins": ["jsx", "typescript"]
}

View File

@ -0,0 +1 @@
<T>(a: T): T => a;

View File

@ -0,0 +1 @@
<T>(a: T): T => a;

View File

@ -0,0 +1 @@
(x?: number): any => x;

View File

@ -0,0 +1 @@
(x?: number): any => x;

View File

@ -0,0 +1 @@
(x: any): x is string => true;

View File

@ -0,0 +1 @@
(x: any): x is string => true;

View File

@ -0,0 +1,4 @@
x as T;
x < y as boolean; // (x < y) as boolean;
x === 1 as number; // x === (1 as number);
x as any as T;

View File

@ -0,0 +1,6 @@
(x as T);
(x < y as boolean); // (x < y) as boolean;
x === (1 as number); // x === (1 as number);
((x as any) as T);

View File

@ -0,0 +1 @@
f(x < 0, /a/);

View File

@ -0,0 +1 @@
f(x < 0, /a/);

View File

@ -0,0 +1,3 @@
(<T> x).y;
(x as T).y;
x!.y;

View File

@ -0,0 +1,3 @@
(<T> x).y;
(x as T).y;
x!.y;

View File

@ -0,0 +1 @@
x!;

View File

@ -0,0 +1 @@
1 + <number> 1;

View File

@ -0,0 +1 @@
1 + (<number> 1);

View File

@ -0,0 +1 @@
<number> 1 + 1;

View File

@ -0,0 +1 @@
(<number> 1) + 1;

View File

@ -0,0 +1 @@
<number> 1;

View File

@ -0,0 +1 @@
(<number> 1);

View File

@ -0,0 +1,6 @@
abstract class C {}
declare abstract class C {}
export abstract class C {}
// `export abstract class { }` is not valid.
// `export default abstract class C { }` is not valid.
// `abstract class` is not valid as an expression.

View File

@ -0,0 +1,7 @@
abstract class C {}
declare abstract class C {}
export abstract class C {} // `export abstract class { }` is not valid.
// `export default abstract class C { }` is not valid.
// `abstract class` is not valid as an expression.

View File

@ -0,0 +1,5 @@
class C {
constructor(x: number, y: number);
constructor(x: string, y: string);
constructor(x: any, y: any) {}
}

View File

@ -0,0 +1,7 @@
class C {
constructor(x: number, y: number);
constructor(x: string, y: string);
constructor(x: any, y: any) {}
}

View File

@ -0,0 +1,7 @@
declare class C {
[x: string]: any;
x;
x: number;
f();
f(): void;
}

View File

@ -0,0 +1,7 @@
declare class C {
[x: string]: any;
x;
x: number;
f();
f(): void;
}

View File

@ -0,0 +1,2 @@
(class extends f()<T> implements X.Y<T> {});
(class C extends f()<T> implements X.Y<T> {});

View File

@ -0,0 +1,3 @@
(class extends f()<T> implements X.Y<T> {});
(class C extends f()<T> implements X.Y<T> {});

View File

@ -0,0 +1,2 @@
(class extends f()<T> {});
(class C extends f()<T> {});

View File

@ -0,0 +1,3 @@
(class extends f()<T> {});
(class C extends f()<T> {});

View File

@ -0,0 +1,2 @@
(class<T> {});
(class C<T> {});

View File

@ -0,0 +1,3 @@
(class<T> {});
(class C<T> {});

View File

@ -0,0 +1,2 @@
(class implements X.Y<T> {});
(class C implements X.Y<T> {});

View File

@ -0,0 +1,3 @@
(class implements X.Y<T> {});
(class C implements X.Y<T> {});

View File

@ -0,0 +1 @@
class C extends f()<T> implements X.Y<T> {}

View File

@ -0,0 +1 @@
class C extends f()<T> implements X.Y<T> {}

View File

@ -0,0 +1 @@
class C extends f()<T> {}

View File

@ -0,0 +1 @@
class C extends f()<T> {}

View File

@ -0,0 +1 @@
class C<T extends object = { x: number }> {}

View File

@ -0,0 +1,3 @@
class C<T extends object = {
x: number;
}> {}

View File

@ -0,0 +1,3 @@
declare class C {
get<T>(): void;
}

View File

@ -0,0 +1,3 @@
declare class C {
get<T>(): void;
}

View File

@ -0,0 +1 @@
class C implements X.Y<T> {}

View File

@ -0,0 +1 @@
class C implements X.Y<T> {}

View File

@ -0,0 +1,4 @@
class C {
[x: string]: any;
readonly [x: string]: any;
}

View File

@ -0,0 +1,4 @@
class C {
[x: string]: any;
readonly [x: string]: any;
}

View File

@ -0,0 +1,6 @@
class C {
public(): void;
public static(): void;
readonly = 0;
async<T>(): void;
}

View File

@ -0,0 +1,6 @@
class C {
public(): void;
public static(): void;
readonly = 0;
async<T>(): void;
}

View File

@ -0,0 +1,3 @@
class C {
public delete(): void;
}

View File

@ -0,0 +1,3 @@
class C {
public delete(): void;
}

View File

@ -0,0 +1,4 @@
class C {
[Symbol.iterator](): void;
[Symbol.iterator]?(): void;
}

View File

@ -0,0 +1,4 @@
class C {
[Symbol.iterator](): void;
[Symbol.iterator]?(): void;
}

View File

@ -0,0 +1,4 @@
class C {
f<T>(a: T, b?: T, ...c: T[]): T {}
[Symbol.iterator]<T>(): T {}
}

View File

@ -0,0 +1,6 @@
class C {
f<T>(a: T, b?: T, ...c: T[]): T {}
[Symbol.iterator]<T>(): T {}
}

View File

@ -0,0 +1,4 @@
class C {
f();
f(): void;
}

View File

@ -0,0 +1,4 @@
class C {
f();
f(): void;
}

View File

@ -0,0 +1,3 @@
class C {
m?(): void {}
}

View File

@ -0,0 +1,4 @@
class C {
m?(): void {}
}

View File

@ -0,0 +1,3 @@
class C {
f(): void {}
}

View File

@ -0,0 +1,4 @@
class C {
f(): void {}
}

View File

@ -0,0 +1,6 @@
class C
{
m()
{
}
}

View File

@ -0,0 +1,4 @@
class C {
m() {}
}

View File

@ -0,0 +1,5 @@
class C
{
m()
n()
}

View File

@ -0,0 +1,4 @@
class C {
m();
n();
}

View File

@ -0,0 +1,11 @@
// Copy of modifiers-methods with 'get'
abstract class C {
abstract get a();
static get s() { return 0; }
public abstract get pua();
public static get pus() { return 0; }
public get pu() { return 0; }
protected get po() { return 0; }
private get pi() { return 0; }
}

View File

@ -0,0 +1,27 @@
// Copy of modifiers-methods with 'get'
abstract class C {
abstract get a();
static get s() {
return 0;
}
public abstract get pua();
public static get pus() {
return 0;
}
public get pu() {
return 0;
}
protected get po() {
return 0;
}
private get pi() {
return 0;
}
}

View File

@ -0,0 +1,11 @@
// Copy of modifiers-methods with 'async'
abstract class C {
abstract async a();
static async s() {}
public abstract async pua();
public static async pus() {}
public async pu() {}
protected async po() {}
private async pi() {}
}

View File

@ -0,0 +1,17 @@
// Copy of modifiers-methods with 'async'
abstract class C {
abstract async a();
static async s() {}
public abstract async pua();
public static async pus() {}
public async pu() {}
protected async po() {}
private async pi() {}
}

View File

@ -0,0 +1,21 @@
abstract class C {
readonly r;
readonly r2?: number;
abstract a;
static s;
public pu;
protected po;
private pi;
readonly abstract ra;
abstract readonly ar;
static readonly sr;
public readonly pur;
public abstract pua;
public static pus;
public readonly abstract pura;
public abstract readonly puar;
public static readonly pusr;
}

View File

@ -0,0 +1,18 @@
abstract class C {
readonly r;
readonly r2?: number;
abstract a;
static s;
public pu;
protected po;
private pi;
abstract readonly ra;
abstract readonly ar;
static readonly sr;
public readonly pur;
public abstract pua;
public static pus;
public abstract readonly pura;
public abstract readonly puar;
public static readonly pusr;
}

View File

@ -0,0 +1,3 @@
class C {
constructor(@foo readonly x: number) {}
}

View File

@ -0,0 +1,5 @@
class C {
constructor(@foo
readonly x: number) {}
}

View File

@ -0,0 +1,3 @@
{
"plugins": ["typescript", "decorators"]
}

Some files were not shown because too many files have changed in this diff Show More