@uoa/lambda-tracing 1.0.0-beta.0 → 1.0.0-beta.1

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.
@@ -79,7 +79,7 @@ function getTraceFlags(
79
79
  return;
80
80
  }
81
81
 
82
- function getInfo(carrier: unknown, getter: TextMapGetter): string {
82
+ function getInfo(carrier: unknown, getter: TextMapGetter): string | undefined {
83
83
  const info = getHeaderValue(carrier, getter, X_B3_INFO);
84
84
  if (typeof info === 'string') {
85
85
  return info;
@@ -101,7 +101,7 @@ export class UoaB3Propagator implements TextMapPropagator {
101
101
  setter.set(carrier, X_B3_TRACE_ID, spanContext.traceId);
102
102
  setter.set(carrier, X_B3_SPAN_ID, spanContext.spanId);
103
103
  const info = context.getValue(B3_INFO_KEY);
104
- if (info) {
104
+ if (info && typeof info === 'string') {
105
105
  setter.set(carrier, X_B3_INFO, info.toString());
106
106
  } else if (getRequestId()) {
107
107
  setter.set(carrier, X_B3_INFO, `lambdaRequestId:${getRequestId()}`);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Class extended from OpenTelemetry B3MultiPropagator so that we can propagate & log the X-B3-Info header
3
+ *
4
+ * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts}
5
+ */
6
+ import { Context, TextMapGetter, TextMapPropagator, TextMapSetter } from '@opentelemetry/api';
7
+ export declare const X_B3_TRACE_ID = "x-b3-traceid";
8
+ export declare const X_B3_SPAN_ID = "x-b3-spanid";
9
+ export declare const X_B3_SAMPLED = "x-b3-sampled";
10
+ export declare const X_B3_PARENT_SPAN_ID = "x-b3-parentspanid";
11
+ export declare const X_B3_FLAGS = "x-b3-flags";
12
+ export declare const X_B3_INFO = "x-b3-info";
13
+ export declare const B3_DEBUG_FLAG_KEY: symbol;
14
+ export declare const B3_INFO_KEY: symbol;
15
+ export declare class UoaB3Propagator implements TextMapPropagator {
16
+ inject(context: Context, carrier: any, setter: TextMapSetter<any>): void;
17
+ extract(context: Context, carrier: any, getter: TextMapGetter<any>): Context;
18
+ fields(): string[];
19
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UoaB3Propagator = exports.B3_INFO_KEY = exports.B3_DEBUG_FLAG_KEY = exports.X_B3_INFO = exports.X_B3_FLAGS = exports.X_B3_PARENT_SPAN_ID = exports.X_B3_SAMPLED = exports.X_B3_SPAN_ID = exports.X_B3_TRACE_ID = void 0;
4
+ /**
5
+ * Class extended from OpenTelemetry B3MultiPropagator so that we can propagate & log the X-B3-Info header
6
+ *
7
+ * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts}
8
+ */
9
+ const api_1 = require("@opentelemetry/api");
10
+ const core_1 = require("@opentelemetry/core");
11
+ const tracing_1 = require("./tracing");
12
+ exports.X_B3_TRACE_ID = 'x-b3-traceid';
13
+ exports.X_B3_SPAN_ID = 'x-b3-spanid';
14
+ exports.X_B3_SAMPLED = 'x-b3-sampled';
15
+ exports.X_B3_PARENT_SPAN_ID = 'x-b3-parentspanid';
16
+ exports.X_B3_FLAGS = 'x-b3-flags';
17
+ exports.X_B3_INFO = 'x-b3-info';
18
+ exports.B3_DEBUG_FLAG_KEY = (0, api_1.createContextKey)('B3 Debug Flag');
19
+ exports.B3_INFO_KEY = (0, api_1.createContextKey)('B3 Info Header');
20
+ const VALID_SAMPLED_VALUES = new Set([true, 'true', 'True', '1', 1]);
21
+ const VALID_UNSAMPLED_VALUES = new Set([false, 'false', 'False', '0', 0]);
22
+ function parseHeader(header) {
23
+ return Array.isArray(header) ? header[0] : header;
24
+ }
25
+ function getHeaderValue(carrier, getter, key) {
26
+ const header = getter.get(carrier, key);
27
+ return parseHeader(header);
28
+ }
29
+ function getTraceId(carrier, getter) {
30
+ const traceId = getHeaderValue(carrier, getter, exports.X_B3_TRACE_ID);
31
+ if (typeof traceId === 'string') {
32
+ return traceId.padStart(32, '0');
33
+ }
34
+ return '';
35
+ }
36
+ function getSpanId(carrier, getter) {
37
+ const spanId = getHeaderValue(carrier, getter, exports.X_B3_SPAN_ID);
38
+ if (typeof spanId === 'string') {
39
+ return spanId;
40
+ }
41
+ return 'aaaaaaaaaaaaaaaa'; //Valid dummy value as spanId will change when AwsLambdaInstrumentation is initialised
42
+ }
43
+ function getDebug(carrier, getter) {
44
+ const debug = getHeaderValue(carrier, getter, exports.X_B3_FLAGS);
45
+ return debug === '1' ? '1' : undefined;
46
+ }
47
+ function getTraceFlags(carrier, getter) {
48
+ const traceFlags = getHeaderValue(carrier, getter, exports.X_B3_SAMPLED);
49
+ const debug = getDebug(carrier, getter);
50
+ if (debug === '1' || VALID_SAMPLED_VALUES.has(traceFlags)) {
51
+ return api_1.TraceFlags.SAMPLED;
52
+ }
53
+ if (traceFlags === undefined || VALID_UNSAMPLED_VALUES.has(traceFlags)) {
54
+ return api_1.TraceFlags.NONE;
55
+ }
56
+ // This indicates to isValidSampledValue that this is not valid
57
+ return;
58
+ }
59
+ function getInfo(carrier, getter) {
60
+ const info = getHeaderValue(carrier, getter, exports.X_B3_INFO);
61
+ if (typeof info === 'string') {
62
+ return info;
63
+ }
64
+ return undefined;
65
+ }
66
+ class UoaB3Propagator {
67
+ inject(context, carrier, setter) {
68
+ const spanContext = api_1.trace.getSpanContext(context);
69
+ if (!spanContext ||
70
+ !(0, api_1.isSpanContextValid)(spanContext) ||
71
+ (0, core_1.isTracingSuppressed)(context))
72
+ return;
73
+ const debug = context.getValue(exports.B3_DEBUG_FLAG_KEY);
74
+ setter.set(carrier, exports.X_B3_TRACE_ID, spanContext.traceId);
75
+ setter.set(carrier, exports.X_B3_SPAN_ID, spanContext.spanId);
76
+ const info = context.getValue(exports.B3_INFO_KEY);
77
+ if (info && typeof info === 'string') {
78
+ setter.set(carrier, exports.X_B3_INFO, info.toString());
79
+ }
80
+ else if ((0, tracing_1.getRequestId)()) {
81
+ setter.set(carrier, exports.X_B3_INFO, `lambdaRequestId:${(0, tracing_1.getRequestId)()}`);
82
+ }
83
+ // According to the B3 spec, if the debug flag is set,
84
+ // the sampled flag shouldn't be propagated as well.
85
+ if (debug === '1') {
86
+ setter.set(carrier, exports.X_B3_FLAGS, debug);
87
+ }
88
+ else if (spanContext.traceFlags !== undefined) {
89
+ // We set the header only if there is an existing sampling decision.
90
+ // Otherwise we will omit it => Absent.
91
+ setter.set(carrier, exports.X_B3_SAMPLED, (api_1.TraceFlags.SAMPLED & spanContext.traceFlags) === api_1.TraceFlags.SAMPLED
92
+ ? '1'
93
+ : '0');
94
+ }
95
+ }
96
+ extract(context, carrier, getter) {
97
+ const traceId = getTraceId(carrier, getter);
98
+ const spanId = getSpanId(carrier, getter);
99
+ const traceFlags = getTraceFlags(carrier, getter);
100
+ const debug = getDebug(carrier, getter);
101
+ const info = getInfo(carrier, getter);
102
+ context = context.setValue(exports.B3_DEBUG_FLAG_KEY, debug);
103
+ if (info) {
104
+ context = context.setValue(exports.B3_INFO_KEY, info);
105
+ }
106
+ return api_1.trace.setSpanContext(context, {
107
+ traceId,
108
+ spanId,
109
+ isRemote: true,
110
+ traceFlags,
111
+ });
112
+ }
113
+ fields() {
114
+ return [
115
+ exports.X_B3_TRACE_ID,
116
+ exports.X_B3_SPAN_ID,
117
+ exports.X_B3_FLAGS,
118
+ exports.X_B3_SAMPLED,
119
+ exports.X_B3_PARENT_SPAN_ID,
120
+ exports.X_B3_INFO
121
+ ];
122
+ }
123
+ }
124
+ exports.UoaB3Propagator = UoaB3Propagator;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const UoaB3Propagator_1 = require("./UoaB3Propagator");
4
+ const tracing_1 = require("./tracing");
5
+ const winston = require('winston');
6
+ const moment = require('moment');
7
+ const path = require('path');
8
+ const { trace, context } = require('@opentelemetry/api');
9
+ const defaultLogPattern = '%date [%thread] %level %class - [[[%traceId,%spanId,%info]]] %message';
10
+ const uoaLogLevels = {
11
+ error: 0,
12
+ warn: 1,
13
+ info: 2,
14
+ debug: 3
15
+ };
16
+ const uoaLoggingFormat = function (callingModule) {
17
+ return winston.format.printf((logInfo) => {
18
+ let logPattern = process.env.loggingPattern ? process.env.loggingPattern : defaultLogPattern;
19
+ const logReplacements = getLogReplacementValues(callingModule, logInfo);
20
+ logReplacements.forEach((value, key) => {
21
+ logPattern = logPattern.replace(key, value);
22
+ });
23
+ return logPattern;
24
+ });
25
+ };
26
+ function getLogReplacementValues(callingModule, logInfo) {
27
+ const parts = callingModule.filename.substring(0, callingModule.filename.lastIndexOf('.js')).split(path.sep);
28
+ const moduleParts = parts.slice(parts.indexOf('src'));
29
+ let traceId = '-';
30
+ let spanId = '-';
31
+ const currentContext = trace.getSpanContext(context.active());
32
+ if (currentContext) {
33
+ traceId = currentContext.traceId;
34
+ spanId = currentContext.spanId;
35
+ }
36
+ let info = '-';
37
+ const infoHeader = context.active().getValue(UoaB3Propagator_1.B3_INFO_KEY);
38
+ if (infoHeader) {
39
+ info = infoHeader.toString();
40
+ }
41
+ else if ((0, tracing_1.getRequestId)()) {
42
+ info = `lambdaRequestId:${(0, tracing_1.getRequestId)()}`;
43
+ }
44
+ let logReplacements = new Map();
45
+ logReplacements.set('%date', moment().toISOString());
46
+ logReplacements.set('%thread', '-');
47
+ logReplacements.set('%level', logInfo.level.toUpperCase());
48
+ logReplacements.set('%class', moduleParts.join('.'));
49
+ logReplacements.set('%traceId', traceId);
50
+ logReplacements.set('%spanId', spanId);
51
+ logReplacements.set('%info', info);
52
+ logReplacements.set('%message', logInfo.message);
53
+ return logReplacements;
54
+ }
55
+ module.exports = function (callingModule) {
56
+ return winston.createLogger({
57
+ levels: uoaLogLevels,
58
+ transports: [
59
+ new winston.transports.Console({
60
+ level: process.env.loggingLevel ? process.env.loggingLevel.toLowerCase() : 'info'
61
+ })
62
+ ],
63
+ format: uoaLoggingFormat(callingModule)
64
+ });
65
+ };
@@ -0,0 +1 @@
1
+ export declare function getRequestId(): string;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRequestId = void 0;
4
+ const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
5
+ const instrumentation_aws_lambda_1 = require("@opentelemetry/instrumentation-aws-lambda");
6
+ const instrumentation_1 = require("@opentelemetry/instrumentation");
7
+ const UoaB3Propagator_1 = require("./UoaB3Propagator");
8
+ const provider = new sdk_trace_node_1.NodeTracerProvider();
9
+ provider.register({
10
+ propagator: new UoaB3Propagator_1.UoaB3Propagator()
11
+ });
12
+ let requestId;
13
+ (0, instrumentation_1.registerInstrumentations)({
14
+ instrumentations: [
15
+ new instrumentation_aws_lambda_1.AwsLambdaInstrumentation({
16
+ requestHook: (span, { event, context }) => {
17
+ span.setAttribute('faas.name', context.functionName);
18
+ requestId = context.awsRequestId;
19
+ },
20
+ responseHook: (span, { err, res }) => {
21
+ if (err instanceof Error)
22
+ span.setAttribute('faas.error', err.message);
23
+ if (res)
24
+ span.setAttribute('faas.res', res);
25
+ },
26
+ disableAwsContextPropagation: true
27
+ })
28
+ ],
29
+ });
30
+ function getRequestId() {
31
+ return requestId;
32
+ }
33
+ exports.getRequestId = getRequestId;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const https = __importStar(require("https"));
27
+ const api_1 = require("@opentelemetry/api");
28
+ function request(...args) {
29
+ if (args[2]) {
30
+ api_1.propagation.inject(api_1.context.active(), args[1].headers);
31
+ return https.request(args[0], args[1], args[2]);
32
+ }
33
+ else {
34
+ api_1.propagation.inject(api_1.context.active(), args[0].headers);
35
+ return https.request(args[0], args[1]);
36
+ }
37
+ }
38
+ function get(...args) {
39
+ if (args[2]) {
40
+ api_1.propagation.inject(api_1.context.active(), args[1].headers);
41
+ return https.get(args[0], args[1], args[2]);
42
+ }
43
+ else {
44
+ api_1.propagation.inject(api_1.context.active(), args[0].headers);
45
+ return https.get(args[0], args[1]);
46
+ }
47
+ }
48
+ module.exports = {
49
+ request,
50
+ get
51
+ };
package/package.json CHANGED
@@ -1,11 +1,7 @@
1
1
  {
2
2
  "name": "@uoa/lambda-tracing",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Library for logging & distributed tracing in UoA Lambda projects",
5
- "main": "tracing.ts",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
5
  "repository": {
10
6
  "type": "git",
11
7
  "url": "git+ssh://git@bitbucket.org/uoa/lambda-tracing.git"
@@ -19,10 +15,16 @@
19
15
  "logging",
20
16
  "distributed-tracing"
21
17
  ],
18
+ "main": "dist/tracing.js",
19
+ "types": "dist/tracing.d.ts",
20
+ "scripts": {
21
+ "test": "echo \"Error: no test specified\" && exit 1",
22
+ "prepublish": "tsc"
23
+ },
22
24
  "exports": {
23
- ".": "./tracing.ts",
24
- "./uoaHttps": "./uoaHttps.ts",
25
- "./logging": "./logging.ts"
25
+ ".": "./dist/tracing.js",
26
+ "./uoaHttps": "./dist/uoaHttps.js",
27
+ "./logging": "./dist/logging.js"
26
28
  },
27
29
  "dependencies": {
28
30
  "@opentelemetry/api": "^1.1.0",
@@ -34,6 +36,7 @@
34
36
  "winston": "^3.7.2"
35
37
  },
36
38
  "devDependencies": {
37
- "@types/node": "^17.0.35"
39
+ "@types/node": "^17.0.35",
40
+ "typescript": "^4.7.2"
38
41
  }
39
42
  }
package/tsconfig.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module": "commonjs", /* Specify what module code is generated. */
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "resolveJsonModule": true, /* Enable importing .json files. */
39
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
40
+
41
+ /* JavaScript Support */
42
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
43
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
44
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
45
+
46
+ /* Emit */
47
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52
+ "outDir": "dist", /* Specify an output folder for all emitted files. */
53
+ // "removeComments": true, /* Disable emitting comments. */
54
+ // "noEmit": true, /* Disable emitting files from a compilation. */
55
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
56
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
57
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
58
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
59
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
62
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
63
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
64
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
65
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
66
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
67
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
69
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
70
+
71
+ /* Interop Constraints */
72
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
73
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
75
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
77
+
78
+ /* Type Checking */
79
+ "strict": true, /* Enable all strict type-checking options. */
80
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
81
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
82
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
83
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
84
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
85
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
86
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
87
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
88
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
89
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
90
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
91
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
92
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
93
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
94
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
95
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
96
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
97
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
98
+
99
+ /* Completeness */
100
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
102
+ }
103
+ }