diff --git a/clients/nodejs/Readme.md b/clients/nodejs/Readme.md new file mode 100644 index 00000000..6f902193 --- /dev/null +++ b/clients/nodejs/Readme.md @@ -0,0 +1,33 @@ +Set directory path that contains superposition object files in SUPERPOSITION_LIB_PATH env variable; + +## [ CAC Client ](./cac-client) + +1. This exports a class that exposes functions that internally call rust functions. +2. For Different platform it read different superposition object files. + * For Mac -> libcac_client.dylib + * For Windows -> libcac_client.so + * For Linux -> libcac_client.dll +3. This run CAC CLient in two thread one is main thread another is worker thread. +4. Worker thread is used to do polling updates ([ref](./cac-client/client.ts#L31)). + + +## [ Experimentation Client ](./exp-client) + +1. This exports a class that exposes functions that internally call rust functions. +2. For Different platform it read different superposition object files. + * For Mac -> libexperimentation_client.dylib + * For Windows -> libexperimentation_client.so + * For Linux -> libexperimentation_client.dll +3. This run Experimentation CLient in two thread one is main thread another is worker thread. +4. Worker thread is used to do polling updates ([ref](./exp-client/client.ts#L31)). + +## [ Test ](./index.ts) + +1. To test this sample project follow below steps. + * Run superposition client. + * Run **npm install** (make sure your node version is >18 ). + * Run **npm run test** this will start a server that runs on port 7000. +2. By Default this sample code uses [dev](./index.ts#L11) tenant. +3. By Default this sample code assumes superposition is running on [8080](./index.ts#L12) port. +3. By Default this sample code polls superposition every [1 second](./index.ts#L13) port. +4. This sample code creates both [CAC CLient](./index.ts#L15) and [Experimentation Client](./index.ts#L16) with above default values. \ No newline at end of file diff --git a/clients/nodejs/cac-client/client.ts b/clients/nodejs/cac-client/client.ts new file mode 100644 index 00000000..f487d796 --- /dev/null +++ b/clients/nodejs/cac-client/client.ts @@ -0,0 +1,170 @@ +import * as ffi from 'ffi-napi'; +import * as ref from 'ref-napi'; +import * as path from 'path'; +import os from 'os'; +import { Worker, isMainThread} from "node:worker_threads"; +import { parentPort } from 'worker_threads'; + +let libPathEnc: string | undefined = process.env.SUPERPOSITION_LIB_PATH; + +if (libPathEnc == "" || libPathEnc == undefined) { + throw new Error("SUPERPOSITION_LIB_PATH not found in env"); +} + +let platform = os.platform(); +let fileName = + platform == "darwin" ? + 'libcac_client.dylib' : + platform == "linux" ? + 'libcac_client.dll' : + 'libcac_client.so' + +const libPath = path.join(libPathEnc, fileName); + +const refType = ref.types; +const int = refType.int; +const string = refType.CString; +const voidType = refType.void; + +// ------------------------------------- +// this code is running on Main Thread +const worker = new Worker(__filename); +// ------------------------------------- + + +// ---------------------------------------- +// this code runs on worker thread +if (!isMainThread && parentPort) { + let cac_client: Map < String, CacClient > = new Map(); + parentPort.on("message", (message) => { + try { + message = JSON.parse(message); + if (message.event === "startPollingUpdate") { + let { + tenant, + pollingFrequency, + cacHostName, + } = message; + let tenantClient = cac_client.get(tenant); + if (tenantClient) { + tenantClient.startPollingUpdate(); + } else { + tenantClient = new CacClient(tenant, pollingFrequency, cacHostName); + cac_client.set(tenant, tenantClient); + tenantClient.startPollingUpdate(); + } + } + } catch (error) { + console.log("Error While starting polling Update for cac client ", error); + } + }) +} +// ----------------------------------------- + +export enum MergeStrategy { + MERGE = "MERGE", + REPLACE = "REPLACE" +} + +export class CacClient { + tenant: string | null = null; + cacHostName: string | null = null; + pollingFrequency: number = 10; + delimeter: string = ","; + + rustLib = ffi.Library(libPath, { + 'cac_new_client': [int, [string, int, string]], + 'cac_get_client': ["pointer", [string]], + 'cac_start_polling_update': [voidType, [string]], + 'cac_free_client': [voidType, ["pointer"]], + 'cac_last_error_message': [string, []], + 'cac_get_config': [string, ["pointer", "pointer", "pointer"]], + 'cac_last_error_length': [int, [voidType]], + 'cac_free_string': [voidType, ["pointer"]], + 'cac_get_last_modified': [string, ["pointer"]], + 'cac_get_resolved_config': [string, ["pointer", string, "pointer", string]], + 'cac_get_default_config': [string, ["pointer", "pointer"]], + + }); + + constructor(tenantName: string, pollingFrequency: number, cacHostName: string) { + if (!tenantName || tenantName == "") { + throw Error("tenantName cannot be null or empty") + } + if (!cacHostName || cacHostName == "") { + throw Error("cacHostName cannot be null or empty") + } + this.tenant = tenantName; + this.pollingFrequency = pollingFrequency; + this.cacHostName = cacHostName; + let resp = this.rustLib.cac_new_client(this.tenant, this.pollingFrequency, this.cacHostName); + if (resp == 1) { + let errorMessage = this.getLastErrorMessage(); + throw Error("Some Error Occur while creating new client " + errorMessage); + } + } + + public getLastErrorMessage(): string { + return this.rustLib.cac_last_error_message() || ""; + } + + public getLastErrorLength(): number { + return this.rustLib.cac_last_error_length() + } + + public getClient(): ref.Pointer { + return this.rustLib.cac_get_client(this.tenant); + } + + public async startPollingUpdate() { + if (isMainThread && worker) { + worker.postMessage( + JSON.stringify({ tenant: this.tenant + , event : "startPollingUpdate" + , pollingFrequency: this.pollingFrequency + , cacHostName: this.cacHostName + }) + ); + return; + } + if (!isMainThread) { + this.rustLib.cac_start_polling_update(this.tenant) + } + } + + public getConfig(filterQuery: Object | undefined, filterPrefix: string[] | undefined): string { + let strFilterQuery = filterQuery ? ref.allocCString(JSON.stringify(filterQuery)) : ref.NULL; + let strFilterPrefix = filterPrefix ? ref.allocCString(filterPrefix.join(this.delimeter)) : ref.NULL; + let clientPtr = this.getClient(); + let resp = this.rustLib.cac_get_config(clientPtr, strFilterQuery, strFilterPrefix) || this.getLastErrorMessage(); + return resp; + } + + freeClient(clientPtr: ref.Pointer) { + this.rustLib.cac_free_client(clientPtr); + } + + freeString(str: ref.Pointer) { + this.rustLib.cac_free_string(str); + } + + public getLastModified(): string { + return this.rustLib.cac_get_last_modified(this.getClient()) || this.getLastErrorMessage(); + } + + public getResolvedConfig(query: Object, filterKeys: string[] | undefined, mergeStrategy: MergeStrategy): string { + let strQuery = JSON.stringify(query); + let strFilterKeys = filterKeys ? ref.allocCString (filterKeys.join("|")) : ref.NULL ; + let resp = this.rustLib.cac_get_resolved_config( + this.getClient(), strQuery, strFilterKeys, mergeStrategy + ) || this.getLastErrorMessage(); + return resp; + } + public getDefaultConfig(filterKeys: string[] | undefined): string { + let strFilterKeys = filterKeys ? ref.allocCString(filterKeys.join("|")) : ref.NULL; + let resp = this.rustLib.cac_get_default_config( + this.getClient(), strFilterKeys + ) || this.getLastErrorMessage(); + return resp; + } +} \ No newline at end of file diff --git a/clients/nodejs/cac-client/package.json b/clients/nodejs/cac-client/package.json new file mode 100644 index 00000000..f12aa158 --- /dev/null +++ b/clients/nodejs/cac-client/package.json @@ -0,0 +1,24 @@ +{ + "name": "nodejs_cac_client", + "version": "1.0.0", + "main": "dist/client.js", + "types": "dist/client.d.ts", + "files": [ + "/dist" + ], + "devDependencies": { + "@types/express": "^4.17.21", + "@types/ffi-napi": "^4.0.10", + "@types/node": "^20.14.10", + "@types/ref-napi": "^3.0.12", + "@types/typescript": "^2.0.0", + "express": "^4.19.2", + "ffi-napi": "^4.0.3", + "ref-napi": "^3.0.3", + "ts-node": "^10.9.2", + "typescript": "^5.5.3" + }, + "scripts": { + "postinstall" : "npx tsc" + } +} diff --git a/clients/nodejs/cac-client/tsconfig.json b/clients/nodejs/cac-client/tsconfig.json new file mode 100644 index 00000000..4be68891 --- /dev/null +++ b/clients/nodejs/cac-client/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "target": "ES2015", + "outDir": "./dist", + "declaration": true, + "esModuleInterop": true + }, + "exclude": ["node_modules"], + "include": ["./client.ts"] +} \ No newline at end of file diff --git a/clients/nodejs/exp-client/client.ts b/clients/nodejs/exp-client/client.ts new file mode 100644 index 00000000..fd29d982 --- /dev/null +++ b/clients/nodejs/exp-client/client.ts @@ -0,0 +1,171 @@ +import * as ffi from 'ffi-napi'; +import * as ref from 'ref-napi'; +import * as path from 'path'; +import os from 'os'; +import { isMainThread, parentPort, Worker } from 'worker_threads'; + +let platform = os.platform(); + + +let libPathEnc: string | undefined = process.env.SUPERPOSITION_LIB_PATH; + +if (libPathEnc == "" || libPathEnc == undefined) { + throw new Error("SUPERPOSITION_LIB_PATH not found in env"); +} + +let fileName = + platform == "darwin" ? + 'libexperimentation_client.dylib' : + platform == "linux" ? + 'libexperimentation_client.dll' : + 'libexperimentation_client.so' + +const libPath = path.join(libPathEnc, fileName); + +const refType = ref.types; +const int = refType.int; +const string = refType.CString; +const voidType = refType.void; + +// ------------------------------------- +// this code is running on Main Thread +const worker = new Worker(__filename); +// ------------------------------------- + + +// ---------------------------------------- +// this code runs on worker thread +if (!isMainThread && parentPort) { + let cac_client: Map < String, ExperimentationClient > = new Map(); + parentPort.on("message", (message) => { + try { + message = JSON.parse(message); + if (message) { + if (message.event === "startPollingUpdate") { + let { + tenant, + pollingFrequency, + cacHostName, + } = message; + let tenantClient = cac_client.get(tenant); + if (tenantClient) { + tenantClient.startPollingUpdate(); + } else { + tenantClient = new ExperimentationClient(tenant, pollingFrequency, cacHostName); + cac_client.set(tenant, tenantClient); + tenantClient.startPollingUpdate(); + } + } + } + } catch (error) { + console.log("Error While starting polling Update for experimentation client ", error); + } + }) +} +// ----------------------------------------- + +class ExperimentationClient { + tenant: string | null = null; + pollingFrequency: number = 10; + cacHostName: string | null = null; + delimeter: string = ","; + + rustLib = ffi.Library(libPath, { + 'expt_new_client': [int, [string, int, string]], + 'expt_start_polling_update': [voidType, [string]], + 'expt_get_client': ["pointer", [string]], + 'expt_get_applicable_variant': [string, ["pointer", string, int]], + 'expt_get_satisfied_experiments': [string, ["pointer", string, "pointer"]], + 'expt_get_filtered_satisfied_experiments': [string, ["pointer", string, "pointer"]], + 'expt_get_running_experiments': [string, ["pointer"]], + 'expt_free_string': [voidType, [string]], + 'expt_last_error_message': [string, []], + 'expt_last_error_length': [int, []], + 'expt_free_client': [voidType, ["pointer"]] + }); + + constructor(tenantName: string, pollingFrequency: number, cacHostName: string) { + if (!tenantName || tenantName == "") { + throw Error("tenantName cannot be null/undefined or empty") + } + if (!cacHostName || cacHostName == "") { + throw Error("cacHostName cannot be null/undefined or empty") + } + this.tenant = tenantName; + this.cacHostName = cacHostName; + this.pollingFrequency = pollingFrequency; + let respCode = this.rustLib.expt_new_client( + this.tenant, this.pollingFrequency, this.cacHostName + ); + if (respCode == 1) { + let errorMessage = this.getLastErrorMessage(); + throw Error("Some Error Occured while creating new experimentation client " + errorMessage); + } + } + + public getLastErrorMessage(): string { + return this.rustLib.expt_last_error_message() || ""; + } + + public getClient(): ref.Pointer { + return this.rustLib.expt_get_client(this.tenant); + } + + public getRunningExpriments(): string { + let clientPtr = this.getClient(); + return this.rustLib.expt_get_running_experiments(clientPtr) || this.getLastErrorMessage(); + } + + freeString(str: string) { + this.rustLib.expt_free_string(str); + } + + public async startPollingUpdate() { + if (isMainThread && worker) { + worker.postMessage( + JSON.stringify({ tenant: this.tenant + , event : "startPollingUpdate" + , pollingFrequency: this.pollingFrequency + , cacHostName: this.cacHostName + }) + ); + return; + } + if (!isMainThread) { + this.rustLib.expt_start_polling_update(this.tenant) + } + } + + public getLastErrorLength(): number { + return this.rustLib.expt_last_error_length() + } + + freeClient(clientPtr: ref.Pointer) { + this.rustLib.expt_free_client(clientPtr); + } + + public getFilteredSatisfiedExperiments(context: Object, filterPrefix: string[] | undefined): string { + let strContext = JSON.stringify(context); + let strFilterPrefix = filterPrefix ? ref.allocCString(filterPrefix.join(this.delimeter)) : ref.NULL; + return this.rustLib.expt_get_filtered_satisfied_experiments( + this.getClient(), strContext, strFilterPrefix + ) || this.getLastErrorMessage(); + } + + public getApplicableVariant(context: Object, toss: number): string { + let strContext = JSON.stringify(context); + return this.rustLib.expt_get_applicable_variant( + this.getClient(), strContext, toss + ) || this.getLastErrorMessage(); + } + + public getSatisfiedExperiments(context: Object, filterPrefix: string[] | undefined): string { + let strContext = JSON.stringify(context); + let strFilterPrefix = filterPrefix ? ref.allocCString(filterPrefix.join(this.delimeter)) : ref.NULL; + return this.rustLib.expt_get_satisfied_experiments( + this.getClient(), strContext, strFilterPrefix + ) || this.getLastErrorMessage(); + } +} + +export default ExperimentationClient; \ No newline at end of file diff --git a/clients/nodejs/exp-client/package.json b/clients/nodejs/exp-client/package.json new file mode 100644 index 00000000..8318fe2c --- /dev/null +++ b/clients/nodejs/exp-client/package.json @@ -0,0 +1,24 @@ +{ + "name": "nodejs_experimentation_client", + "version": "1.0.0", + "main": "dist/client.js", + "types": "dist/client.d.ts", + "files": [ + "/dist" + ], + "devDependencies": { + "@types/express": "^4.17.21", + "@types/ffi-napi": "^4.0.10", + "@types/node": "^20.14.10", + "@types/ref-napi": "^3.0.12", + "@types/typescript": "^2.0.0", + "express": "^4.19.2", + "ffi-napi": "^4.0.3", + "ref-napi": "^3.0.3", + "ts-node": "^10.9.2", + "typescript": "^5.5.3" + }, + "scripts": { + "postinstall" : "npx tsc" + } +} diff --git a/clients/nodejs/exp-client/tsconfig.json b/clients/nodejs/exp-client/tsconfig.json new file mode 100644 index 00000000..4be68891 --- /dev/null +++ b/clients/nodejs/exp-client/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "target": "ES2015", + "outDir": "./dist", + "declaration": true, + "esModuleInterop": true + }, + "exclude": ["node_modules"], + "include": ["./client.ts"] +} \ No newline at end of file diff --git a/clients/nodejs/index.ts b/clients/nodejs/index.ts new file mode 100644 index 00000000..aec914fd --- /dev/null +++ b/clients/nodejs/index.ts @@ -0,0 +1,29 @@ +import express, { + Request, + Response +} from 'express'; +import {CacClient} from 'cac_client'; +import ExperimentationClient from 'experimentation_client'; + +const app = express(); +const port = process.env.PORT || 7000; + +let tenantName: string = "dev"; +let superpositionHost: string = "http://localhost:8080"; +let pollingFrequency: number = 1; + +let CACClient = new CacClient(tenantName, pollingFrequency, superpositionHost); +let ExpClient = new ExperimentationClient(tenantName, pollingFrequency, superpositionHost); + +ExpClient.startPollingUpdate(); +CACClient.startPollingUpdate(); + +app.get('/', (_: Request, res: Response) => { + let defaultConfig = CACClient.getConfig({}, []); + let runningExpriments = ExpClient.getRunningExpriments(); + res.send({defaultConfig, runningExpriments}); +}); + +app.listen(port, () => { + console.log(`Server running at http://localhost:${port}`); +}); \ No newline at end of file diff --git a/clients/nodejs/package.json b/clients/nodejs/package.json new file mode 100644 index 00000000..59cb6569 --- /dev/null +++ b/clients/nodejs/package.json @@ -0,0 +1,17 @@ +{ + "name": "test", + "version": "1.0.0", + "dependencies": { + "cac_client" : "file:./cac-client/", + "experimentation_client" : "file:./exp-client/" + }, + "devDependencies": { + "express": "^4.19.2", + "ts-node": "^10.9.2", + "typescript": "^5.5.3" + }, + "scripts": { + "test" : "npx tsc && node ./dist/index.js" + } + } + \ No newline at end of file diff --git a/clients/nodejs/tsconfig.json b/clients/nodejs/tsconfig.json new file mode 100644 index 00000000..25e143b9 --- /dev/null +++ b/clients/nodejs/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "outDir": "./dist", + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "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. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +}