-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy patharguments.ts
More file actions
27 lines (25 loc) · 872 Bytes
/
arguments.ts
File metadata and controls
27 lines (25 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as ts from "typescript";
import * as tstl from "../../../src";
interface Options {
name: string;
option: boolean;
}
export default function plugin(options: Options): tstl.Plugin {
return {
visitors: {
[ts.SyntaxKind.ReturnStatement]: () =>
tstl.createReturnStatement([
tstl.createTableExpression([
tstl.createTableFieldExpression(
tstl.createStringLiteral(options.name),
tstl.createStringLiteral("name")
),
tstl.createTableFieldExpression(
tstl.createBooleanLiteral(options.option),
tstl.createStringLiteral("option")
),
]),
]),
},
};
}