From 20f5329c111bb7717d515be41d5a3f61443e4b49 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Mon, 28 Nov 2022 11:31:06 -0500 Subject: [PATCH] fix: add typescript definitions (#35) * feat: add typescript * try to lint --- .github/workflows/ci.yml | 2 +- cypress/e2e/children/children-spec.js | 3 +- dist/index.d.ts | 89 +++++++++++ dist/index.d.ts.map | 1 + dist/index.js | 208 ++++++++++++++++++++++++++ package-lock.json | 22 ++- package.json | 14 +- src/{index.js => index.ts} | 57 +++---- tsconfig.json | 107 +++++++++++++ 9 files changed, 469 insertions(+), 34 deletions(-) create mode 100644 dist/index.d.ts create mode 100644 dist/index.d.ts.map create mode 100644 dist/index.js rename src/{index.js => index.ts} (79%) create mode 100644 tsconfig.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfb0bc4..6fe3610 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: # https://github.com/cypress-io/github-action uses: cypress-io/github-action@v4 with: - build: npm run stop-only + build: npm run stop-only && npm run build - name: Semantic Release 🚀 uses: cycjimmy/semantic-release-action@v3 diff --git a/cypress/e2e/children/children-spec.js b/cypress/e2e/children/children-spec.js index 236d9bf..b0a0676 100644 --- a/cypress/e2e/children/children-spec.js +++ b/cypress/e2e/children/children-spec.js @@ -1,5 +1,4 @@ -/// -import { really, map, invoke, toDate } from '../../..' +import { really, invoke } from '../../..' describe( 'count children elements', diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..ec46c0b --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,89 @@ +declare function really(): (value: unknown) => any; +declare function pipe(...fns: Function[]): (value: unknown) => unknown; +/** + * Transforms an object or a list of objects using the supplied function or name of the property. + * @param {Function} fn Function to apply to each object + * @returns {Object|Array} Transformed value + * @example cy.get('.todo').then(map('innerText')) + */ +declare function map(fn: Function): (list: unknown) => any; +/** + * Filter the values by the given predicate function. + * @param {Function} predicate + */ +declare function filter(predicate: Function): (list: unknown) => any; +/** + * Invokes the given name (with optional arguments) on the given object. + * @param {String} methodName + * @param {...any} args + * @returns Result of the method invocation + * @example + * cy.get('dates') + * .then(map('innerText')) + * .then(toDate) + * .then(invoke('getTime')) + */ +declare function invoke(methodName: string, ...args: unknown[]): (list: unknown | unknown[]) => any; +/** + * Grabs a property or a nested path from the given object. + * @param {String} path + * @returns Value of the property + * @example + * cy.wrap({ foo: 'bar' }).then(its('foo')) + */ +declare function its(path: string): (o: object) => unknown; +/** + * Curried > N function + * @param {number} n + * @returns Boolean + * @example + * expect(greaterThan(10)(5)).to.be.false + */ +declare function greaterThan(n: number): (x: number) => boolean; +/** + * Curried deep comparison + * @param {any} isEqual + */ +declare function isEqual(expectedValue: any): (actualValue: any) => boolean; +/** + * Takes a function and returns a function that expects the first two + * arguments in the reverse order. + * @param {Function} fn Function to call + * @returns Function + * @example + * flipTwoArguments(Cypress._.map)(x => x * 2, [1, 2, 3]) + */ +declare function flipTwoArguments(fn: Function): (a: unknown, b: unknown) => any; +/** + * Converts the given string into a JavaScript Date object + * @param {String} s dateString + * @returns {Date} Date instance + * @deprecated Use "constructor(Date)" instead + */ +declare function toDate(s: string): Date; +/** + * Returns a function that waits for the argument, passes that argument + * to the given callback, but returns the original value. Useful + * for debugging data transformations. + * @param {Function} fn + * @example cyw.wrap(1).then(tap(console.log)).should('equal', 1) + */ +declare function tap(fn: Function): (x: unknown) => unknown; +/** + * Returns a function with the first argument bound. + * @param {Function} fn Function to partially apply + * @param {any} a First argument to apply + * @example + * const add = (a, b) => a + b + * const addOne = partial(add, 1) + * addOne(2) // 3 + */ +declare function partial(fn: Function, a: unknown): any; +/** + * Given a constructor function, returns a function + * that waits for a single argument before calling "new constructor(arg)" + * @example constructor(Date) + * @see https://glebbahmutov.com/blog/work-around-the-keyword-new-in-javascript/ + */ +declare function construct(constructor: Function): (arg: unknown) => any; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map new file mode 100644 index 0000000..ba77bbd --- /dev/null +++ b/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,iBAAS,MAAM,YAkBW,OAAO,SAahC;AAED,iBAAS,IAAI,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,WACN,OAAO,aAGhC;AAED;;;;;GAKG;AACH,iBAAS,GAAG,CAAC,EAAE,EAAE,QAAQ,UACA,OAAO,SAQ/B;AAED;;;GAGG;AACH,iBAAS,MAAM,CAAC,SAAS,EAAE,QAAQ,UACV,OAAO,SAW/B;AAED;;;;;;;;;;GAUG;AACH,iBAAS,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,UAC7B,OAAO,GAAG,OAAO,EAAE,SAmB3C;AAED;;;;;;GAMG;AACH,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,OACH,MAAM,aAG3B;AAED;;;;;;GAMG;AACH,iBAAS,WAAW,CAAC,CAAC,EAAE,MAAM,OACR,MAAM,aAG3B;AAED;;;GAGG;AACH,iBAAS,OAAO,CAAC,aAAa,EAAE,GAAG,iBACH,GAAG,aAGlC;AAED;;;;;;;GAOG;AACH,iBAAS,gBAAgB,CAAC,EAAE,EAAE,QAAQ,OAChB,OAAO,KAAK,OAAO,SAGxC;AAED;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,CAAC,EAAE,MAAM,QAExB;AAED;;;;;;GAMG;AACH,iBAAS,GAAG,CAAC,EAAE,EAAE,QAAQ,OACH,OAAO,aAI5B;AAED;;;;;;;;GAQG;AACH,iBAAS,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,OAExC;AAED;;;;;GAKG;AACH,iBAAS,SAAS,CAAC,WAAW,EAAE,QAAQ,SAChB,OAAO,SAI9B"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..6fe5f41 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,208 @@ +"use strict"; +/// +function really() { + if (!arguments.length) { + throw new Error('really() needs arguments really badly'); + } + const fns = Cypress._.takeWhile(arguments, (arg) => typeof arg === 'function'); + const chainerIndex = Cypress._.findIndex(arguments, (arg) => typeof arg === 'string'); + if (chainerIndex === -1) { + throw new Error('sh: no chainer found'); + } + const chainer = arguments[chainerIndex]; + const chainerArguments = Cypress._.slice(arguments, chainerIndex + 1); + const chainers = chainer.split('.'); + const fn = pipe(...fns); + return function (value) { + // console.log('value', value) + const transformed = fn(value); + // console.log('transformed', transformed) + return chainers.reduce((acc, chainer) => { + const currentChainer = acc[chainer]; + if (typeof currentChainer === 'function') { + return acc[chainer](...chainerArguments); + } + else { + return acc[chainer]; + } + }, expect(transformed).to); + }; +} +function pipe(...fns) { + return function (value) { + return fns.reduce((acc, fn) => fn(acc), value); + }; +} +/** + * Transforms an object or a list of objects using the supplied function or name of the property. + * @param {Function} fn Function to apply to each object + * @returns {Object|Array} Transformed value + * @example cy.get('.todo').then(map('innerText')) + */ +function map(fn) { + return function (list) { + if (Cypress._.isArrayLike(list)) { + const callbackFn = typeof fn === 'function' ? (x) => fn(x) : fn; + return Cypress._.map(list, callbackFn); + } + else { + return fn(list); + } + }; +} +/** + * Filter the values by the given predicate function. + * @param {Function} predicate + */ +function filter(predicate) { + return function (list) { + if (Cypress._.isArrayLike(list)) { + const callbackFn = typeof predicate === 'function' + ? (x) => predicate(x) + : predicate; + return Cypress._.filter(list, callbackFn); + } + else { + return predicate(list); + } + }; +} +/** + * Invokes the given name (with optional arguments) on the given object. + * @param {String} methodName + * @param {...any} args + * @returns Result of the method invocation + * @example + * cy.get('dates') + * .then(map('innerText')) + * .then(toDate) + * .then(invoke('getTime')) + */ +function invoke(methodName, ...args) { + return function (list) { + if (arguments.length > 1) { + // the user tried to pass extra arguments with the list/object + // that is a mistake! + throw new Error(`Call to "${methodName}" must have a single argument`); + } + // @ts-ignore + if (typeof list[methodName] === 'function') { + // @ts-ignore + return list[methodName](...args); + } + if (Cypress._.isArrayLike(list)) { + return Cypress._.invokeMap(list, methodName, ...args); + } + else { + return Cypress._.invoke(list, methodName, ...args); + } + }; +} +/** + * Grabs a property or a nested path from the given object. + * @param {String} path + * @returns Value of the property + * @example + * cy.wrap({ foo: 'bar' }).then(its('foo')) + */ +function its(path) { + return function (o) { + return Cypress._.property(path)(o); + }; +} +/** + * Curried > N function + * @param {number} n + * @returns Boolean + * @example + * expect(greaterThan(10)(5)).to.be.false + */ +function greaterThan(n) { + return function (x) { + return x > n; + }; +} +/** + * Curried deep comparison + * @param {any} isEqual + */ +function isEqual(expectedValue) { + return function (actualValue) { + return Cypress._.isEqual(actualValue, expectedValue); + }; +} +/** + * Takes a function and returns a function that expects the first two + * arguments in the reverse order. + * @param {Function} fn Function to call + * @returns Function + * @example + * flipTwoArguments(Cypress._.map)(x => x * 2, [1, 2, 3]) + */ +function flipTwoArguments(fn) { + return function (a, b) { + return fn(b, a); + }; +} +/** + * Converts the given string into a JavaScript Date object + * @param {String} s dateString + * @returns {Date} Date instance + * @deprecated Use "constructor(Date)" instead + */ +function toDate(s) { + return new Date(s); +} +/** + * Returns a function that waits for the argument, passes that argument + * to the given callback, but returns the original value. Useful + * for debugging data transformations. + * @param {Function} fn + * @example cyw.wrap(1).then(tap(console.log)).should('equal', 1) + */ +function tap(fn) { + return function (x) { + fn(x); + return x; + }; +} +/** + * Returns a function with the first argument bound. + * @param {Function} fn Function to partially apply + * @param {any} a First argument to apply + * @example + * const add = (a, b) => a + b + * const addOne = partial(add, 1) + * addOne(2) // 3 + */ +function partial(fn, a) { + return fn.bind(null, a); +} +/** + * Given a constructor function, returns a function + * that waits for a single argument before calling "new constructor(arg)" + * @example constructor(Date) + * @see https://glebbahmutov.com/blog/work-around-the-keyword-new-in-javascript/ + */ +function construct(constructor) { + return function (arg) { + // @ts-ignore + return new constructor(arg); + }; +} +module.exports = { + really, + // utility functions + map, + construct, + invoke, + filter, + its, + pipe, + toDate, + tap, + partial, + isEqual, + greaterThan, + flipTwoArguments, +}; diff --git a/package-lock.json b/package-lock.json index e273def..88f4279 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,8 @@ "cypress": "^11.2.0", "prettier": "2.7.1", "semantic-release": "19.0.5", - "stop-only": "3.1.2" + "stop-only": "3.1.2", + "typescript": "^4.9.3" } }, "node_modules/@babel/code-frame": { @@ -7296,6 +7297,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typescript": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/uglify-js": { "version": "3.14.5", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz", @@ -12943,6 +12957,12 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, + "typescript": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", + "dev": true + }, "uglify-js": { "version": "3.14.5", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz", diff --git a/package.json b/package.json index 737cf50..38ecc94 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,19 @@ "name": "cypress-should-really", "version": "0.0.0-development", "description": "Functional helpers for constructing Cypress should callbacks", - "main": "src", + "main": "dist", + "types": "dist/index.d.ts", "files": [ - "src" + "src", + "dist" ], "scripts": { "test": "cypress run", "semantic-release": "semantic-release", - "stop-only": "stop-only --folder cypress/e2e" + "stop-only": "stop-only --folder cypress/e2e", + "build": "tsc -b", + "watch": "tsc -w", + "lint": "tsc --noEmit" }, "repository": { "type": "git", @@ -29,6 +34,7 @@ "cypress": "^11.2.0", "prettier": "2.7.1", "semantic-release": "19.0.5", - "stop-only": "3.1.2" + "stop-only": "3.1.2", + "typescript": "^4.9.3" } } diff --git a/src/index.js b/src/index.ts similarity index 79% rename from src/index.js rename to src/index.ts index 35a324e..70bc1f7 100644 --- a/src/index.js +++ b/src/index.ts @@ -18,11 +18,11 @@ function really() { const chainers = chainer.split('.') const fn = pipe(...fns) - return function (value) { + return function (value: unknown) { // console.log('value', value) const transformed = fn(value) // console.log('transformed', transformed) - return chainers.reduce((acc, chainer) => { + return chainers.reduce((acc: any, chainer: string) => { const currentChainer = acc[chainer] if (typeof currentChainer === 'function') { return acc[chainer](...chainerArguments) @@ -33,8 +33,8 @@ function really() { } } -function pipe(...fns) { - return function (value) { +function pipe(...fns: Function[]) { + return function (value: unknown) { return fns.reduce((acc, fn) => fn(acc), value) } } @@ -45,10 +45,10 @@ function pipe(...fns) { * @returns {Object|Array} Transformed value * @example cy.get('.todo').then(map('innerText')) */ -function map(fn) { - return function (list) { +function map(fn: Function) { + return function (list: unknown) { if (Cypress._.isArrayLike(list)) { - const callbackFn = typeof fn === 'function' ? (x) => fn(x) : fn + const callbackFn = typeof fn === 'function' ? (x: unknown) => fn(x) : fn return Cypress._.map(list, callbackFn) } else { return fn(list) @@ -60,11 +60,13 @@ function map(fn) { * Filter the values by the given predicate function. * @param {Function} predicate */ -function filter(predicate) { - return function (list) { +function filter(predicate: Function) { + return function (list: unknown) { if (Cypress._.isArrayLike(list)) { const callbackFn = - typeof predicate === 'function' ? (x) => predicate(x) : predicate + typeof predicate === 'function' + ? (x: unknown) => predicate(x) + : predicate return Cypress._.filter(list, callbackFn) } else { return predicate(list) @@ -83,15 +85,17 @@ function filter(predicate) { * .then(toDate) * .then(invoke('getTime')) */ -function invoke(methodName, ...args) { - return function (list) { +function invoke(methodName: string, ...args: unknown[]) { + return function (list: unknown | unknown[]) { if (arguments.length > 1) { // the user tried to pass extra arguments with the list/object // that is a mistake! throw new Error(`Call to "${methodName}" must have a single argument`) } + // @ts-ignore if (typeof list[methodName] === 'function') { + // @ts-ignore return list[methodName](...args) } @@ -110,8 +114,8 @@ function invoke(methodName, ...args) { * @example * cy.wrap({ foo: 'bar' }).then(its('foo')) */ -function its(path) { - return function (o) { +function its(path: string) { + return function (o: object) { return Cypress._.property(path)(o) } } @@ -123,8 +127,8 @@ function its(path) { * @example * expect(greaterThan(10)(5)).to.be.false */ -function greaterThan(n) { - return function (x) { +function greaterThan(n: number) { + return function (x: number) { return x > n } } @@ -133,8 +137,8 @@ function greaterThan(n) { * Curried deep comparison * @param {any} isEqual */ -function isEqual(expectedValue) { - return function (actualValue) { +function isEqual(expectedValue: any) { + return function (actualValue: any) { return Cypress._.isEqual(actualValue, expectedValue) } } @@ -147,8 +151,8 @@ function isEqual(expectedValue) { * @example * flipTwoArguments(Cypress._.map)(x => x * 2, [1, 2, 3]) */ -function flipTwoArguments(fn) { - return function (a, b) { +function flipTwoArguments(fn: Function) { + return function (a: unknown, b: unknown) { return fn(b, a) } } @@ -159,7 +163,7 @@ function flipTwoArguments(fn) { * @returns {Date} Date instance * @deprecated Use "constructor(Date)" instead */ -function toDate(s) { +function toDate(s: string) { return new Date(s) } @@ -170,8 +174,8 @@ function toDate(s) { * @param {Function} fn * @example cyw.wrap(1).then(tap(console.log)).should('equal', 1) */ -function tap(fn) { - return function (x) { +function tap(fn: Function) { + return function (x: unknown) { fn(x) return x } @@ -186,7 +190,7 @@ function tap(fn) { * const addOne = partial(add, 1) * addOne(2) // 3 */ -function partial(fn, a) { +function partial(fn: Function, a: unknown) { return fn.bind(null, a) } @@ -196,8 +200,9 @@ function partial(fn, a) { * @example constructor(Date) * @see https://glebbahmutov.com/blog/work-around-the-keyword-new-in-javascript/ */ -function construct(constructor) { - return function (arg) { +function construct(constructor: Function) { + return function (arg: unknown) { + // @ts-ignore return new constructor(arg) } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e555339 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,107 @@ +{ + "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. */, + "lib": [ + "DOM", + "ESNext" + ] /* 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 TC39 stage 2 draft 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": "node", /* 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. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": false /* 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": false /* Only output d.ts files and not JavaScript files. */, + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "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": "./dist" /* 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. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "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. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "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. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "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. */ + }, + "include": ["./src/index.ts"] +}