From 0a43babcbf235f86c88d7c8de02480c8815fd55b Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 29 Jun 2022 10:43:33 +0100 Subject: [PATCH 1/3] Add devdep @tsconfig/react-native v2 - Basically Definately Typed for TSConfigs - https://github.com/tsconfig/bases#react-native-tsconfigjson --- ...ct-native-npm-2.0.0-77023320a3-7b73900ceb.zip | Bin 0 -> 2728 bytes package.json | 1 + yarn.lock | 8 ++++++++ 3 files changed, 9 insertions(+) create mode 100644 .yarn/cache/@tsconfig-react-native-npm-2.0.0-77023320a3-7b73900ceb.zip diff --git a/.yarn/cache/@tsconfig-react-native-npm-2.0.0-77023320a3-7b73900ceb.zip b/.yarn/cache/@tsconfig-react-native-npm-2.0.0-77023320a3-7b73900ceb.zip new file mode 100644 index 0000000000000000000000000000000000000000..c3777ee7b24a4e2cb8944fd2b18b7638589e980e GIT binary patch literal 2728 zcma)8eLT}^8{fPSW26#}yr$*ZjIa|W!<@`ZONB;eF*6!#W6E|oUzt87)-+$cK_rC7yzV7e!#oCLCDFK$v@@BWx z%H-=0yfg*|`4I7xAfJ%qM7ja?hf6oFU1}Lj_YMm5C6j*Qr1N7Z8j;`~3=1R#lNrRX z2qFNfl?ZXvGafV%0KiZT0MK72f`gqk+UX$rsIz_Y3k0O@FW01Bg_r}($#$_jZjM7O zhW5K+8zHWmwq?*45d)d^?-=^%gprSXd_6FtG2;_TFz?EHHR7Qvin~LeV5{J>qsbuJ zR=CC8hjU}9-W)J#v$ljlOV+f9t9seWT(^%zmF%)Wn4bqFL$goZ(nAg;0ZpvqUG#! zgyywuQdqKn)|QAq_<`6L$>C~W*f&DL-~O^IVXyK|H-GtsL-JJvOqCL5%h@W!0>x=fxr*`cSoi6ImBU_TUwN|Bw&~HCV6k=QqN*XIMgFDl& z8B6&qK?X%J392puz}_EWpw!K6S8)*s!92E~$LH=5gI3j_sxc z36EITE^Uz~9{?_a4W#pqu@c{!jGgxAV#4sI5~hW2AP2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package.json +++ b/package.json @@ -64,6 +64,7 @@ "@storybook/react-native-server": "next", "@swc/core": "1.2.206", "@swc/wasm": "1.2.206", + "@tsconfig/react-native": "2.0.0", "@types/jest": "27.5.2", "@types/node": "16.11.41", "@types/react": "18.0.14", diff --git a/yarn.lock b/yarn.lock index b1edffdca..278f74572 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4235,6 +4235,13 @@ __metadata: languageName: node linkType: hard +"@tsconfig/react-native@npm:2.0.0": + version: 2.0.0 + resolution: "@tsconfig/react-native@npm:2.0.0" + checksum: 7b73900ceb7a7a139f22fa0f1fce007dc4f693e64b72eed2139668ac4732147106f7255c9d5e3c6011164dd8fe9e9cf36ffec27d272b3149caefcbcf85e25d95 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.0.0, @types/babel__core@npm:^7.1.14": version: 7.1.14 resolution: "@types/babel__core@npm:7.1.14" @@ -14935,6 +14942,7 @@ fsevents@^1.2.7: "@storybook/react-native-server": next "@swc/core": 1.2.206 "@swc/wasm": 1.2.206 + "@tsconfig/react-native": 2.0.0 "@types/jest": 27.5.2 "@types/node": 16.11.41 "@types/react": 18.0.14 From 164838dedaa39c33d95c65eb022c0c6dac290ffc Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 30 Jun 2022 15:38:20 +0100 Subject: [PATCH 2/3] Extend recommended @tsconfig/react-native v2 and update - Update TSConfig to 4.7.4 (tsc --init) keeping needed configs - Extend recommended @tsconfig/react-native v2 - Basically Definately Typed for TSConfigs - https://github.com/tsconfig/bases#react-native-tsconfigjson --- tsconfig.json | 147 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 95 insertions(+), 52 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 01bacfb4b..9a386cbd1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,62 +1,105 @@ - { + "extends": "@tsconfig/react-native/tsconfig.json", /* Recommended React Native TSConfig base */ "compilerOptions": { - /* Basic Options */ - "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2019"], /* Specify library files to be included in the compilation. */ - "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - "jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./lib", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "removeComments": true, /* Do not emit comments to output. */ - "noEmit": true, /* Do not emit outputs. */ - "incremental": true, /* Enable incremental compilation */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + /* 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": "esnext", /* (Extended) Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": ["es2016"], /* (Extended) Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "react-native", /* (Extended) 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", /* (Extended) Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* (Extended) 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": ["react-native", "jest"], /* (Extended) 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, /* (Extended) 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. */ - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + /* JavaScript Support */ + // "allowJs": true, /* (Extended) 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'. */ - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + /* 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. */ + // "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, /* (Extended) 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. */ - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + /* Interop Constraints */ + // "isolatedModules": true, /* (Extended) Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* (Extended) Allow 'import x from y' when a module doesn't have a default export. */ + // "esModuleInterop": true, /* (Extended) 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. */ - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + /* Type Checking */ + // "strict": true, /* (Extended) 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. */ - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "resolveJsonModule": true, - "skipLibCheck": true /* Ignore e.g. node_modules: @storybook/client-api/dist/story_store.d.ts; @types/reach__router/index.d.ts; more likely to come', */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "files":[ "index.ts", From db9e93528631d52020225dbbe074474ed4cdb648 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 30 Jun 2022 15:43:55 +0100 Subject: [PATCH 3/3] Update TS type defs to ES2019 https://github.com/tsconfig/bases/pull/116 --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 9a386cbd1..8f9c8ed88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ /* Language and Environment */ // "target": "esnext", /* (Extended) Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": ["es2016"], /* (Extended) Specify a set of bundled library declaration files that describe the target runtime environment. */ + "lib": ["es2019"], /* (Extended: es2017) Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "react-native", /* (Extended) 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. */