Skip to content

Commit

Permalink
package/reflexbox: initial setup for generating types
Browse files Browse the repository at this point in the history
+ latest `typescript` as `devDependency` on the root level
+ `tsconfig.json` & types for dependencies per package
+ npm script `types` per package

issue with types from `@emotion/styles` described in emotion-js/emotion#1640
  • Loading branch information
karfau committed Nov 17, 2019
1 parent 8649ed4 commit c5d1d58
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"lerna": "^3.16.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.8.6"
"react-test-renderer": "^16.8.6",
"typescript": "3.7.2"
},
"jest": {
"testMatch": [
Expand Down
7 changes: 6 additions & 1 deletion packages/reflexbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
],
"scripts": {
"prepare": "babel src -d dist && yarn styled-components",
"styled-components": "NODE_ENV=styled babel src -d styled-components"
"styled-components": "NODE_ENV=styled babel src -d styled-components",
"types": "tsc --declaration"
},
"dependencies": {
"@emotion/core": "^10.0.0",
Expand All @@ -32,6 +33,10 @@
"license": "MIT",
"repository": "rebassjs/rebass",
"devDependencies": {
"@types/styled-components": "^4.4.0",
"@types/styled-system": "^5.1.3",
"@types/styled-system__css": "^5.0.4",
"@types/styled-system__should-forward-prop": "^5.1.0",
"babel-plugin-transform-rename-import": "^2.3.0"
},
"gitHead": "f0f01843e9fb63ca69112d7e97a1451b27ee9e6c"
Expand Down
96 changes: 96 additions & 0 deletions packages/reflexbox/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"compilerOptions": {
/* Basic Options */
/* Enable incremental compilation */
// "incremental": true,
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "es6",
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"module": "commonjs",
/* Specify library files to be included in the compilation. */
"lib": [
"es6"
],
/* Allow javascript files to be compiled. */
"allowJs": true,
/* Report errors in .js files. */
"checkJs": true,
/* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "jsx": "preserve",
/* Generates corresponding '.d.ts' file. */
// "declaration": true,
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
/* Redirect output structure to the directory. */
"outDir": "./dist",
/* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"rootDir": "./src",
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
/* Do not emit comments to output. */
"removeComments": false,
// "noEmit": true, /* Do not emit outputs. */
// "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'). */

/* Strict Type-Checking Options */
/* Enable all strict type-checking options. */
"strict": true,
/* Raise error on expressions and declarations with an implied 'any' type. */
"noImplicitAny": false,
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "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. */

/* 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. */

/* 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. */
/* List of folders to include type definitions from. */
// "typeRoots": [],
/* Type declaration files to be included in compilation.
Needed to add this to avoid errors regarding certain files in `../../node_modules/...`
Source for idea: https://stackoverflow.com/questions/35382157/typescript-build-getting-errors-from-node-modules-folder
*/
"types": [
"../../node_modules/typescript/lib/lib.es6"
],
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
/* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

/* 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. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
/* Disallow inconsistently-cased references to the same file. */
"forceConsistentCasingInFileNames": true
},
/* files to consider, the default is not enough in our case */
"include": [
"./src/**/*.*"
]
/* Could be an option at some point in time, but not needed currently */
// "exclude": ["**/node_modules/**"]
}
48 changes: 47 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@
dependencies:
regenerator-runtime "^0.13.2"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.7.2":
version "7.7.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a"
integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw==
Expand Down Expand Up @@ -3115,6 +3115,14 @@
dependencies:
"@types/react" "*"

"@types/react-native@*":
version "0.60.22"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.60.22.tgz#ba199a441cb0612514244ffb1d0fe6f04c878575"
integrity sha512-LTXMKEyGA+x4kadmjujX6yAgpcaZutJ01lC7zLJWCULaZg7Qw5/3iOQpwIJRUcOc+a8A2RR7rSxplehVf9IuhA==
dependencies:
"@types/prop-types" "*"
"@types/react" "*"

"@types/react@*", "@types/react@^16.8.12", "@types/react@^16.8.6":
version "16.8.25"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.25.tgz#0247613ab58b1b11ba10fed662e1947c5f2bb89c"
Expand All @@ -3136,6 +3144,34 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==

"@types/styled-components@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-4.4.0.tgz#15a3d59533fd3a5bd013db4a7c4422ec542c59d2"
integrity sha512-QFl+w3hQJNHE64Or3PXMFpC3HAQDiuQLi5o9m1XPEwYWfgCZtAribO5ksjxnO8U0LG8Parh0ESCgVxo4VfxlHg==
dependencies:
"@types/react" "*"
"@types/react-native" "*"
csstype "^2.2.0"

"@types/styled-system@^5.1.3":
version "5.1.3"
resolved "https://registry.yarnpkg.com/@types/styled-system/-/styled-system-5.1.3.tgz#d840c8369c1b8115b84bff0fb9846fcd494204a5"
integrity sha512-YLmQz8sNtLBg5JAuCfkdRl0Hf6KB/eM4wVmy+I3HEMWs35rmExF1BOBydEXjcgfiQ3bu/v+7RBu0whkOYtz4WQ==
dependencies:
csstype "^2.6.4"

"@types/styled-system__css@^5.0.4":
version "5.0.4"
resolved "https://registry.yarnpkg.com/@types/styled-system__css/-/styled-system__css-5.0.4.tgz#df83b015cf377ab39ecf33ea31339c05eeb9230a"
integrity sha512-SHHoNh9cCRTG9hcmCD2ua0NeYUrLmLXoMJ7g0U/e0FjrzcwNQtM5wjjEJVCVZymU632xA1PdPEykrtoSHTIecA==
dependencies:
csstype "^2.6.6"

"@types/styled-system__should-forward-prop@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@types/styled-system__should-forward-prop/-/styled-system__should-forward-prop-5.1.0.tgz#b531eee45616182af6b59f8b5f36ae6d30b30ab2"
integrity sha512-3ibb+6ORE3HPc/yrcZE9TVLVRDna2919xu2FXK05VSy9h4odgkz4wHvmTdgEExERH4lMmY4cDS0p9MsJjC75Yg==

"@types/testing-library__dom@*", "@types/testing-library__dom@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.0.0.tgz#89d756b5b31f4b9632bcf04ff86f2a427671d195"
Expand Down Expand Up @@ -6034,6 +6070,11 @@ csstype@^2.2.0, csstype@^2.5.7:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.6.tgz#c34f8226a94bbb10c32cc0d714afdf942291fc41"
integrity sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg==

csstype@^2.6.4, csstype@^2.6.6:
version "2.6.7"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.7.tgz#20b0024c20b6718f4eda3853a1f5a1cce7f5e4a5"
integrity sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ==

currently-unhandled@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
Expand Down Expand Up @@ -16543,6 +16584,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==

ua-parser-js@^0.7.18:
version "0.7.20"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.20.tgz#7527178b82f6a62a0f243d1f94fd30e3e3c21098"
Expand Down

0 comments on commit c5d1d58

Please sign in to comment.