json-as 0.2.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,430 @@
1
+ /*import {
2
+ IdentifierExpression,
3
+ Parser,
4
+ ClassDeclaration,
5
+ CommonFlags,
6
+ TypeName,
7
+ NamedTypeNode,
8
+ VariableLikeDeclarationStatement,
9
+ DiagnosticCode,
10
+ ObjectLiteralExpression,
11
+ Expression,
12
+ Range,
13
+ ParameterKind,
14
+ Statement,
15
+ } from "assemblyscript";
16
+ import { Transform } from "assemblyscript/transform";
17
+
18
+ export default class MyTransform extends Transform {
19
+ // @ts-ignore
20
+ readFile(filename: string, baseDir: string) {
21
+ return null;
22
+ }
23
+ afterParse(p: Parser) {
24
+ p.sources.forEach((s) => {
25
+ if (s.isLibrary) return;
26
+ s.statements.forEach((s) => {
27
+ if (s instanceof ClassDeclaration) {
28
+ let __DECOR;
29
+ if (
30
+ __DECOR = s.decorators?.find(
31
+ (d) =>
32
+ d.name instanceof IdentifierExpression && d.name.text == "json"
33
+ )
34
+ ) {
35
+ const __DEFAULT_RANGE = __DECOR.range;
36
+ const members = s.members.filter<VariableLikeDeclarationStatement>(
37
+ (e): e is VariableLikeDeclarationStatement =>
38
+ e instanceof VariableLikeDeclarationStatement
39
+ );
40
+ members.forEach((e) => {
41
+ if (!e.type) {
42
+ p.error(
43
+ DiagnosticCode.User_defined_0,
44
+ e.range,
45
+ "Type information must be specified for JSON serialization.", ""
46
+ );
47
+ }
48
+ });
49
+ const SimpleNames = ["u8", "u16", "string", "f32"];
50
+ const Param = Expression.createIdentifierExpression(
51
+ "param",
52
+ __DEFAULT_RANGE
53
+ );
54
+ const GenericMapType = Expression.createNamedType(
55
+ Expression.createSimpleTypeName("string", __DEFAULT_RANGE),
56
+ [
57
+ Expression.createNamedType(
58
+ new TypeName(
59
+ Expression.createIdentifierExpression(
60
+ "JSON",
61
+ __DEFAULT_RANGE
62
+ ),
63
+ Expression.createSimpleTypeName(
64
+ "_Variant",
65
+ __DEFAULT_RANGE
66
+ ),
67
+ __DEFAULT_RANGE
68
+ ),
69
+ null,
70
+ false,
71
+ __DEFAULT_RANGE
72
+ ),
73
+ ],
74
+ false,
75
+ __DEFAULT_RANGE
76
+ );
77
+ let kvr: [IdentifierExpression, Expression][] = [];
78
+
79
+ members.forEach((m) => {
80
+ if (
81
+ m.type instanceof NamedTypeNode &&
82
+ m.type.name.next == null &&
83
+ SimpleNames.includes(m.type.name.identifier.text)
84
+ ) {
85
+ kvr.push([
86
+ Expression.createIdentifierExpression(m.name.text, m.range),
87
+ Expression.createCallExpression(
88
+ Expression.createElementAccessExpression(
89
+ Param,
90
+ Expression.createIdentifierExpression(
91
+ "get",
92
+ __DEFAULT_RANGE
93
+ ),
94
+ __DEFAULT_RANGE
95
+ ),
96
+ [m.type!],
97
+ [],
98
+ __DEFAULT_RANGE
99
+ ),
100
+ ]);
101
+ } else {
102
+ kvr.push([
103
+ Expression.createIdentifierExpression(m.name.text, m.range),
104
+ Expression.createCallExpression(
105
+ Expression.createPropertyAccessExpression(
106
+ m.type!,
107
+ Expression.createIdentifierExpression(
108
+ "__Json__Deserialize",
109
+ __DEFAULT_RANGE
110
+ ),
111
+ __DEFAULT_RANGE
112
+ ),
113
+ [],
114
+ [
115
+ Expression.createCallExpression(
116
+ Expression.createElementAccessExpression(
117
+ Param,
118
+ Expression.createIdentifierExpression(
119
+ "get",
120
+ __DEFAULT_RANGE
121
+ ),
122
+ __DEFAULT_RANGE
123
+ ),
124
+ [GenericMapType],
125
+ [],
126
+ __DEFAULT_RANGE
127
+ ),
128
+ ],
129
+ __DEFAULT_RANGE
130
+ ),
131
+ ]);
132
+ }
133
+ });
134
+ const objectliteral = new ObjectLiteralExpression(
135
+ kvr.map((e) => e[0]),
136
+ kvr.map((e) => e[1]),
137
+ __DEFAULT_RANGE
138
+ );
139
+ console.log(kvr[0]?.map(e => !!e))
140
+ console.log(kvr[1]?.map(e => !!e))
141
+ s.members.push(
142
+ Expression.createMethodDeclaration(
143
+ Expression.createIdentifierExpression(
144
+ "__Json__Deserialize",
145
+ __DEFAULT_RANGE
146
+ ),
147
+ null,
148
+ CommonFlags.STATIC,
149
+ null,
150
+ Expression.createFunctionType(
151
+ [
152
+ Expression.createParameter(
153
+ ParameterKind.DEFAULT,
154
+ Expression.createIdentifierExpression(
155
+ "param",
156
+ __DEFAULT_RANGE
157
+ ),
158
+ GenericMapType,
159
+ null,
160
+ __DEFAULT_RANGE
161
+ ),
162
+ ],
163
+ Expression.createNamedType(
164
+ (console.log(s.name.text), Expression.createSimpleTypeName(s.name.text + '1', __DEFAULT_RANGE)),
165
+ null,
166
+ false,
167
+ __DEFAULT_RANGE
168
+ ),
169
+ null,
170
+ false,
171
+ __DEFAULT_RANGE
172
+ ),
173
+ Statement.createBlockStatement(
174
+ [
175
+ Statement.createReturnStatement(
176
+ objectliteral,
177
+ __DEFAULT_RANGE
178
+ ),
179
+ ],
180
+ __DEFAULT_RANGE
181
+ ),
182
+ __DEFAULT_RANGE
183
+ )
184
+ );
185
+ }
186
+ }
187
+ });
188
+ });
189
+ }
190
+ }
191
+ */
192
+ import {
193
+ ClassPrototype,
194
+ IdentifierExpression,
195
+ ImportStatement,
196
+ Parser,
197
+ Program,
198
+ FieldPrototype,
199
+ ClassDeclaration,
200
+ MethodDeclaration,
201
+ CommonFlags,
202
+ FunctionTypeNode,
203
+ TypeName,
204
+ BlockStatement,
205
+ FunctionPrototype,
206
+ NamedTypeNode,
207
+ ReturnStatement,
208
+ StringLiteralExpression,
209
+ VariableDeclaration,
210
+ VariableStatement,
211
+ BinaryExpression,
212
+ ExpressionStatement,
213
+ Token,
214
+ PropertyAccessExpression,
215
+ CallExpression,
216
+ ThisExpression,
217
+ } from "assemblyscript/assemblyscript";
218
+ import { Transform } from "assemblyscript/transform";
219
+ import {
220
+ NodeKind,
221
+ TypeNode,
222
+ TypeParameterNode,
223
+ } from "types:assemblyscript/src/ast";
224
+
225
+ export default class MyTransform extends Transform {
226
+ readFile(filename: string, baseDir: string) {
227
+ return null;
228
+ }
229
+ afterParse(p: Parser) {
230
+ p.sources.forEach((s) => {
231
+ if (s.isLibrary) return;
232
+ s.statements.forEach((s) => {
233
+ if (s instanceof ImportStatement) {
234
+ // console.log(s.internalPath);
235
+ // console.log(s.path.value.charAt(s.path.value.length - 1));
236
+ if (s.path.value.charAt(s.path.value.length - 1) == "~") {
237
+ s.path.value = s.path.value.slice(0, s.path.value.length - 1);
238
+ s.internalPath = s.internalPath.slice(0, s.internalPath.length - 1);
239
+ }
240
+ }
241
+ });
242
+ });
243
+ }
244
+ afterInitialize(program: Program): void {
245
+ // initializer(program);
246
+ // console.log(program.managedClasses);
247
+ //program.filesByName.forEach((e) => {
248
+ // console.log(e.name);
249
+ //});
250
+ program.elementsByName.forEach((c) => {
251
+ //program.elementsByName.forEach((e) => {});
252
+ if (c instanceof ClassPrototype) {
253
+ if (
254
+ !!c.decoratorNodes?.find((e) => {
255
+ /** detect decorator */
256
+ return (
257
+ e.name instanceof IdentifierExpression && e.name.text == "json"
258
+ );
259
+ })
260
+ ) {
261
+ // console.log({ ...c, program: {}, parent: {} });
262
+
263
+ c.members?.forEach((m) => {
264
+ //console.log(ElementKind[m.kind]);
265
+ if (m instanceof FieldPrototype) {
266
+ console.log(m.name);
267
+ }
268
+ });
269
+ let fnBody = new BlockStatement(
270
+ [
271
+ new VariableStatement(
272
+ null,
273
+ [
274
+ new VariableDeclaration(
275
+ new IdentifierExpression(
276
+ "_str",
277
+ false,
278
+ c.declaration.range
279
+ ),
280
+ null,
281
+ CommonFlags.LET,
282
+ null,
283
+ new StringLiteralExpression("{", c.declaration.range),
284
+ c.declaration.range
285
+ ),
286
+ ],
287
+ c.declaration.range
288
+ ),
289
+ ],
290
+ c.declaration.range
291
+ );
292
+ const escapeChars = (e: string) => {
293
+ let outChars = "";
294
+ let cchhar = "";
295
+ for (let i = 0; i < e.length; i++) {
296
+ cchhar = e.charAt(i);
297
+
298
+ if (cchhar == '"') {
299
+ outChars += `\\"` + cchhar;
300
+ } else {
301
+ outChars += cchhar;
302
+ }
303
+ }
304
+ return outChars;
305
+ };
306
+ let i = 0;
307
+ const size = c.instanceMembers!.size;
308
+ let d;
309
+ for (const field of c.instanceMembers!.values()) {
310
+ // Leave out trailing commas
311
+ if (i < size - 1) {
312
+ d = new StringLiteralExpression(",", c.declaration.range);
313
+ } else {
314
+ d = new StringLiteralExpression("", c.declaration.range);
315
+ }
316
+ if (field instanceof FieldPrototype) {
317
+ fnBody.statements.push(
318
+ new ExpressionStatement(
319
+ new BinaryExpression(
320
+ Token.PLUS_EQUALS,
321
+ new IdentifierExpression(
322
+ "_str",
323
+ false,
324
+ c.declaration.range
325
+ ),
326
+ new BinaryExpression(
327
+ Token.PLUS,
328
+ new StringLiteralExpression(
329
+ '"' + escapeChars(field.name) + '":',
330
+ c.declaration.range
331
+ ),
332
+ new BinaryExpression(
333
+ Token.PLUS,
334
+ new CallExpression(
335
+ new PropertyAccessExpression(
336
+ new IdentifierExpression(
337
+ "JSON",
338
+ false,
339
+ c.declaration.range
340
+ ),
341
+ new IdentifierExpression(
342
+ "stringify",
343
+ false,
344
+ c.declaration.range
345
+ ),
346
+ c.declaration.range
347
+ ),
348
+ null,
349
+ [
350
+ new PropertyAccessExpression(
351
+ new ThisExpression(c.declaration.range),
352
+ new IdentifierExpression(
353
+ field.name,
354
+ false,
355
+ c.declaration.range
356
+ ),
357
+ c.declaration.range
358
+ ),
359
+ ],
360
+ c.declaration.range
361
+ ),
362
+ d,
363
+ c.declaration.range
364
+ ),
365
+ c.declaration.range
366
+ ),
367
+ c.declaration.range
368
+ )
369
+ )
370
+ );
371
+ }
372
+ i++;
373
+ }
374
+ fnBody.statements.push(
375
+ new ReturnStatement(
376
+ new BinaryExpression(
377
+ Token.PLUS,
378
+ new IdentifierExpression("_str", false, c.declaration.range),
379
+ new StringLiteralExpression("}", c.declaration.range),
380
+ c.declaration.range
381
+ ),
382
+ c.declaration.range
383
+ )
384
+ );
385
+ let __JSON_Serialize = new FunctionPrototype(
386
+ "__JSON_Serialize",
387
+ c,
388
+ new MethodDeclaration(
389
+ new IdentifierExpression(
390
+ "__JSON_Serialize",
391
+ false,
392
+ c.declaration.range
393
+ ),
394
+ null,
395
+ CommonFlags.INSTANCE,
396
+ null,
397
+ new FunctionTypeNode(
398
+ [],
399
+ new NamedTypeNode(
400
+ new TypeName(
401
+ new IdentifierExpression(
402
+ "string",
403
+ false,
404
+ c.declaration.range
405
+ ),
406
+ null,
407
+ c.declaration.range
408
+ ),
409
+ null,
410
+ false,
411
+ c.declaration.range
412
+ ),
413
+ null,
414
+ false,
415
+ c.declaration.range
416
+ ),
417
+ fnBody,
418
+ c.declaration.range
419
+ )
420
+ );
421
+ c.instanceMembers?.set("__JSON_Serialize", __JSON_Serialize);
422
+ (c.declaration as ClassDeclaration).members.push(
423
+ __JSON_Serialize.declaration
424
+ );
425
+ }
426
+ }
427
+ });
428
+ }
429
+ }
430
+
@@ -0,0 +1,98 @@
1
+ import {
2
+ ClassDeclaration,
3
+ FieldDeclaration,
4
+ MethodDeclaration,
5
+ Source
6
+ } from "assemblyscript/dist/assemblyscript";
7
+ import { ClassDecorator, registerDecorator } from "visitor-as/dist/decorator.js";
8
+ import { getName } from "visitor-as/dist/utils.js";
9
+ import { SimpleParser } from "visitor-as/dist/index.js";
10
+
11
+ class AsJSONTransform extends ClassDecorator {
12
+ public currentClass!: ClassDeclaration;
13
+ public sources: Source[] = [];
14
+ public encodeStmts = new Map<string, string[]>();
15
+ public decodeCode = new Map<string, string[]>();
16
+
17
+ visitMethodDeclaration(node: MethodDeclaration): void {}
18
+ visitFieldDeclaration(node: FieldDeclaration): void {
19
+ const name = getName(node);
20
+ if (!node.type) {
21
+ throw new Error(`Field ${name} is missing a type declaration`);
22
+ }
23
+
24
+ const type = getName(node.type);
25
+
26
+ const className = this.currentClass!.name.text
27
+ if (!this.encodeStmts.has(className)) this.encodeStmts.set(className, [])
28
+ if (!this.decodeCode.has(className)) this.decodeCode.set(className, [])
29
+ // @ts-ignore
30
+ this.encodeStmts.get(className).push(
31
+ `this.__JSON_Serialized += '' + '"' + '${name}' + '"' + ':' + JSON.stringify<${type}>(this.${name}) + ',';`
32
+ );
33
+
34
+ // @ts-ignore
35
+ this.decodeCode.get(className).push(
36
+ `${name}: JSON.parse<${type}>(values.get("${name}")),\n`
37
+ );
38
+ }
39
+ visitClassDeclaration(node: ClassDeclaration): void {
40
+ if (!node.members) {
41
+ return;
42
+ }
43
+
44
+ this.currentClass = node;
45
+
46
+ const name = getName(node);
47
+
48
+ this.encodeStmts.delete(name);
49
+ this.decodeCode.delete(name);
50
+ this.visit(node.members);
51
+
52
+ const serializedProp = `__JSON_Serialized: string = "";`
53
+
54
+ let serializeFunc = ``
55
+
56
+ if (this.encodeStmts.has(name) && this.encodeStmts.get(name)) {
57
+ serializeFunc = `
58
+ __JSON_Serialize(): string {
59
+ if (!this.__JSON_Serialized) {
60
+ ${// @ts-ignore
61
+ this.encodeStmts.get(name).join("\n")};
62
+ this.__JSON_Serialized = "{" + this.__JSON_Serialized.slice(0, this.__JSON_Serialized.length - 1) + "}";
63
+ }
64
+ return this.__JSON_Serialized;
65
+ }
66
+ `
67
+ } else {
68
+ serializeFunc = `
69
+ __JSON_Serialize(): string {
70
+ return "{}";
71
+ }
72
+ `
73
+ }
74
+
75
+ const deserializeFunc = `
76
+ __JSON_Deserialize(values: Map<string, string>): ${name} {
77
+ return {
78
+ ${// @ts-ignore
79
+ this.decodeCode.get(name) ? this.decodeCode.get(name).join("") : ""}
80
+ }
81
+ }
82
+ `;
83
+ //console.log(serializedProp, serializeFunc, deserializeFunc)
84
+ const serializedProperty = SimpleParser.parseClassMember(serializedProp, node);
85
+ node.members.push(serializedProperty);
86
+
87
+ const serializeMethod = SimpleParser.parseClassMember(serializeFunc, node);
88
+ node.members.push(serializeMethod);
89
+
90
+ const deserializeMethod = SimpleParser.parseClassMember(deserializeFunc, node);
91
+ node.members.push(deserializeMethod);
92
+ }
93
+ get name(): string {
94
+ return "json";
95
+ }
96
+ }
97
+
98
+ export default registerDecorator(new AsJSONTransform());
@@ -1,71 +1,70 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- // "lib": [], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
- "declaration": false, /* Generates corresponding '.d.ts' file. */
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- "sourceMap": false, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- "outDir": "./lib/", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
18
- // "composite": true, /* Enable project compilation */
19
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
20
- // "removeComments": true, /* Do not emit comments to output. */
21
- // "noEmit": true, /* Do not emit outputs. */
22
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
23
- "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
24
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
25
-
26
- /* Strict Type-Checking Options */
27
- "strict": true, /* Enable all strict type-checking options. */
28
- "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'unknown' type. */
29
- "strictNullChecks": true, /* Enable strict null checks. */
30
- "strictFunctionTypes": true, /* Enable strict checking of function types. */
31
- "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
32
- "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
33
- "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'unknown' type. */
34
- "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
35
-
36
- /* Additional Checks */
37
- "noUnusedLocals": true, /* Report errors on unused locals. */
38
- "noUnusedParameters": true, /* Report errors on unused parameters. */
39
- "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
40
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41
- "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
42
- "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
43
-
44
- /* Module Resolution Options */
45
- // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
46
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
47
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
48
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
49
- // "typeRoots": [], /* List of folders to include type definitions from. */
50
- // "types": [], /* Type declaration files to be included in compilation. */
51
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
52
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
53
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
54
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
55
-
56
- /* Source Map Options */
57
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
58
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
59
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
60
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
61
-
62
- /* Experimental Options */
63
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
64
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
65
-
66
- /* Advanced Options */
67
- "skipLibCheck": true, /* Skip type checking of declaration files. */
68
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
69
- }
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Basic Options */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
8
+ "module": "es6" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
9
+ // "lib": [], /* Specify library files to be included in the compilation. */
10
+ // "allowJs": true, /* Allow javascript files to be compiled. */
11
+ // "checkJs": true, /* Report errors in .js files. */
12
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
+ "declaration": false /* Generates corresponding '.d.ts' file. */,
14
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
+ "sourceMap": false /* Generates corresponding '.map' file. */,
16
+ // "outFile": "./", /* Concatenate and emit output to single file. */
17
+ "outDir": "./lib/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
18
+ // "composite": true, /* Enable project compilation */
19
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
20
+ // "removeComments": true, /* Do not emit comments to output. */
21
+ // "noEmit": true, /* Do not emit outputs. */
22
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
23
+ "downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
24
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
25
+
26
+ /* Strict Type-Checking Options */
27
+ "strict": true /* Enable all strict type-checking options. */,
28
+ "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'Unknown' type. */,
29
+ "strictNullChecks": true /* Enable strict null checks. */,
30
+ "strictFunctionTypes": true /* Enable strict checking of function types. */,
31
+ "strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
32
+ "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
33
+ "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'Unknown' type. */,
34
+ "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
35
+
36
+ /* Additional Checks */
37
+ "noUnusedLocals": true /* Report errors on unused locals. */,
38
+ "noUnusedParameters": true /* Report errors on unused parameters. */,
39
+ "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
40
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41
+ "noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */,
42
+ "noPropertyAccessFromIndexSignature": true /* Require undeclared properties from index signatures to use element accesses. */,
43
+
44
+ /* Module Resolution Options */
45
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
46
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
47
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
48
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
49
+ // "typeRoots": [], /* List of folders to include type definitions from. */
50
+ // "types": [], /* Type declaration files to be included in compilation. */
51
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
52
+ "esModuleInterop": false /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
53
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
54
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
55
+
56
+ /* Source Map Options */
57
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
58
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
59
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
60
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
61
+
62
+ /* Experimental Options */
63
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
64
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
65
+
66
+ /* Advanced Options */
67
+ "skipLibCheck": true /* Skip type checking of declaration files. */,
68
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
70
69
  }
71
-
70
+ }