Skip to content

Instantly share code, notes, and snippets.

@aleclarson
Created November 12, 2020 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleclarson/6ae9a3b6b9d06c492fb9a3b6ec395411 to your computer and use it in GitHub Desktop.
Save aleclarson/6ae9a3b6b9d06c492fb9a3b6ec395411 to your computer and use it in GitHub Desktop.
Failed attempt to apply separate tsconfig.json to __tests__ and __stories__ modules
commit 3c0e91303b54f3e01ff136f11e9f4b08017a9a45
Author: Alec Larson <1925840+aleclarson@users.noreply.github.com>
Date: Thu Nov 12 18:41:10 2020 -0500
wip
diff --git a/app/tsconfig.base.json b/app/tsconfig.base.json
new file mode 100644
index 0000000..8123fe5
--- /dev/null
+++ b/app/tsconfig.base.json
@@ -0,0 +1,12 @@
+{
+ "files": [],
+ "compilerOptions": {
+ "esModuleInterop": true,
+ "jsx": "react",
+ "lib": ["es2017"],
+ "moduleResolution": "node",
+ "noEmit": true,
+ "strict": true,
+ "target": "esnext"
+ }
+}
diff --git a/app/tsconfig.json b/app/tsconfig.json
index 5448f71..2bbefd1 100644
--- a/app/tsconfig.json
+++ b/app/tsconfig.json
@@ -1,17 +1,8 @@
{
- "include": ["src"],
- "compilerOptions": {
- "baseUrl": ".",
- "esModuleInterop": true,
- "jsx": "react",
- "lib": ["es2017"],
- "moduleResolution": "node",
- "noEmit": true,
- "paths": {
- "storybook": ["../storybook"]
- },
- "plugins": [{ "name": "typescript-snapshots-plugin" }],
- "strict": true,
- "target": "esnext"
- }
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.test.json" },
+ { "path": "./tsconfig.story.json" },
+ { "path": "./tsconfig.native.json" }
+ ]
}
diff --git a/app/tsconfig.native.json b/app/tsconfig.native.json
new file mode 100644
index 0000000..d789660
--- /dev/null
+++ b/app/tsconfig.native.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.base.json",
+ "include": ["src/*", "src/**/*"],
+ "exclude": ["**/__stories__/*", "**/__tests__/*"],
+ "compilerOptions": {
+ "types": [],
+ "typeRoots": []
+ }
+}
diff --git a/app/tsconfig.story.json b/app/tsconfig.story.json
new file mode 100644
index 0000000..72fce59
--- /dev/null
+++ b/app/tsconfig.story.json
@@ -0,0 +1,11 @@
+{
+ "extends": "./tsconfig.base.json",
+ "include": ["src/**/__stories__/*"],
+ "exclude": [],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "storybook": ["../storybook"]
+ }
+ }
+}
diff --git a/app/tsconfig.test.json b/app/tsconfig.test.json
new file mode 100644
index 0000000..42c1385
--- /dev/null
+++ b/app/tsconfig.test.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.base.json",
+ "include": ["src/**/__tests__/*"],
+ "exclude": [],
+ "compilerOptions": {
+ "plugins": [{ "name": "typescript-snapshots-plugin" }],
+ "types": ["jest"]
+ }
+}
@aleclarson
Copy link
Author

Note: I tried "include": ["src"] in tsconfig.native.json and it made no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment