forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.ts
More file actions
24 lines (23 loc) · 1.1 KB
/
factory.ts
File metadata and controls
24 lines (23 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace ts {
describe("FactoryAPI", () => {
describe("createArrowFunction", () => {
it("parenthesizes concise body if necessary", () => {
function checkBody(body: ConciseBody) {
const node = createArrowFunction(
/*modifiers*/ undefined,
/*typeParameters*/ undefined,
[],
/*type*/ undefined,
/*equalsGreaterThanToken*/ undefined,
body,
);
assert.strictEqual(node.body.kind, SyntaxKind.ParenthesizedExpression);
}
checkBody(createObjectLiteral());
checkBody(createPropertyAccess(createObjectLiteral(), "prop"));
checkBody(createAsExpression(createPropertyAccess(createObjectLiteral(), "prop"), createTypeReferenceNode("T", /*typeArguments*/ undefined)));
checkBody(createNonNullExpression(createPropertyAccess(createObjectLiteral(), "prop")));
});
});
});
}