├── .gitignore
├── LICENSE
├── README.md
├── dist
├── index.d.ts
├── index.d.ts.map
├── index.js
└── index.js.map
├── package-lock.json
├── package.json
├── src
└── index.tsx
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Phong Nguyen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # Minact
6 |
7 | [](https://bundlephobia.com/result?p=minact)
8 | [](https://www.npmjs.com/package/minact)
9 | [](https://www.npmjs.com/package/minact)
10 |
11 | A simple react state management library without a provider
12 |
13 | ## Demo
14 |
15 | [https://codesandbox.io/s/minact-demo-b3f6nd](https://codesandbox.io/s/minact-demo-b3f6nd?file=/src/store/index.js)
16 |
17 | ## Installation
18 |
19 | ```bash
20 | npm install minact
21 | # or
22 | # yarn add minact
23 | ```
24 |
25 | ## Usage
26 |
27 | ### Create a store
28 |
29 | ```javascript
30 | import { createStore } from "minact";
31 |
32 | export const { useSelector, useDispatch } = createStore(
33 | { count: 0 },
34 | (set, get) => ({
35 | increase: (amount) => set({ count: get().count + (amount || 1) }),
36 | })
37 | );
38 | ```
39 |
40 | ### Use the hooks inside your components
41 |
42 | ```jsx
43 | const View = () => {
44 | const count = useSelector((state) => state.count);
45 |
46 | return Count: {count}
;
47 | };
48 |
49 | const Controls = () => {
50 | const increase = useDispatch((reducers) => reducers.increase);
51 |
52 | return increase()}>Increase ;
53 | };
54 | ```
55 |
56 | ### Async actions
57 |
58 | Just call the `set` function to update the store, async functions don't matter.
59 |
60 | ```javascript
61 | createStore({ data: null }, (set, get) => ({
62 | update: async (url) => {
63 | const res = await fetch(url);
64 | const data = await res.json();
65 | set({ data });
66 | },
67 | }));
68 | ```
69 |
70 | ### Multiple selectors
71 |
72 | ```jsx
73 | const App = () => {
74 | const { count, user } = useSelector((state) => ({
75 | count: state.count,
76 | user: state.user,
77 | }));
78 |
79 | // or
80 |
81 | const [ count, user ] = useSelector((state) => [
82 | count: state.count,
83 | user: state.user,
84 | ]);
85 |
86 | // useDispatch also works
87 |
88 | const { increase, decrease } = useDispatch((reducers) => ({
89 | increase: reducers.increase,
90 | decrease: reducers.decrease,
91 | }));
92 |
93 | // or
94 |
95 | const [ increase, decrease ] = useDispatch((reducers) => [
96 | increase: reducers.increase,
97 | decrease: reducers.decrease,
98 | ]);
99 | };
100 | ```
101 |
102 | ### Usage outside of react component
103 |
104 | ```javascript
105 | const store = createStore({ count: 0 }, (set, get) => ({
106 | increase: () => set({ count: get().count + 1 }),
107 | }));
108 |
109 | // Subscribe to store changes and log the state
110 | const unsubscribe = store.subscribe(() => console.log(store.get()));
111 |
112 | // Unsubscribe from changes
113 | unsubscribe();
114 | ```
115 |
116 | ### Scales very well
117 |
118 | ```
119 | src
120 | │── store
121 | │ │── user-store.js
122 | │ │── count-store.js
123 | │ │── any-store.js
124 | ```
125 |
126 | You can create as many store as you want, they will work independently from each other
127 |
--------------------------------------------------------------------------------
/dist/index.d.ts:
--------------------------------------------------------------------------------
1 | export declare const createStore: {
4 | [key: string]: Function;
5 | }>(initialState: X, initialReducers: Y) => {
6 | useSelector: (selector: (state: X) => any) => any;
7 | useDispatch: (selector: (reducers: ReturnType) => any) => any;
8 | subscribe: (listener: Function) => () => void;
9 | get: () => X;
10 | };
11 | //# sourceMappingURL=index.d.ts.map
--------------------------------------------------------------------------------
/dist/index.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;mBAEN,QAAQ,OAAO,QAAQ;;;0CAqBM,GAAG;yDAqBY,GAAG;0BARlC,QAAQ;;CAetC,CAAC"}
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | export const createStore = (initialState, initialReducers) => {
3 | let listeners = [];
4 | let state = initialState;
5 | const set = (changer) => {
6 | state = Object.assign(Object.assign({}, state), changer);
7 | listeners.forEach((listener) => listener());
8 | };
9 | const get = () => {
10 | return state;
11 | };
12 | let reducers = initialReducers(set, get);
13 | const useSelector = (selector) => {
14 | const [selected, setSelected] = useState(selector(state));
15 | useEffect(() => {
16 | listeners.push(() => {
17 | const newSelected = selector(state);
18 | setSelected(newSelected);
19 | });
20 | }, []);
21 | return selected;
22 | };
23 | const subscribe = (listener) => {
24 | listeners.push(listener);
25 | return () => {
26 | listeners = listeners.filter((item) => item !== listener);
27 | };
28 | };
29 | const useDispatch = (selector) => {
30 | const selected = selector(reducers);
31 | return selected;
32 | };
33 | return { useSelector, useDispatch, subscribe, get };
34 | };
35 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/dist/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,CAIzB,YAAe,EACf,eAAkB,EAClB,EAAE;IACF,IAAI,SAAS,GAAe,EAAE,CAAC;IAE/B,IAAI,KAAK,GAAG,YAAY,CAAC;IAEzB,MAAM,GAAG,GAAG,CAAC,OAA+B,EAAE,EAAE;QAC9C,KAAK,mCAAQ,KAAK,GAAK,OAAO,CAAE,CAAC;QAEjC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,GAAG,EAAE;QACf,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,IAAI,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAkB,CAAC;IAE1D,MAAM,WAAW,GAAG,CAAC,QAA2B,EAAE,EAAE;QAClD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAE1D,SAAS,CAAC,GAAG,EAAE;YACb,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;gBAClB,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACpC,WAAW,CAAC,WAAW,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,QAAkB,EAAE,EAAE;QACvC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,QAA0C,EAAE,EAAE;QACjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEpC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AACtD,CAAC,CAAC"}
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "minact",
3 | "version": "1.0.2",
4 | "lockfileVersion": 2,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "minact",
9 | "version": "1.0.2",
10 | "license": "MIT",
11 | "devDependencies": {
12 | "@types/react": "^17.0.39",
13 | "react": "^17.0.2",
14 | "typescript": "^4.5.5"
15 | },
16 | "peerDependencies": {
17 | "react": ">=17.0.2"
18 | }
19 | },
20 | "node_modules/@types/prop-types": {
21 | "version": "15.7.4",
22 | "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz",
23 | "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==",
24 | "dev": true
25 | },
26 | "node_modules/@types/react": {
27 | "version": "17.0.39",
28 | "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
29 | "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
30 | "dev": true,
31 | "dependencies": {
32 | "@types/prop-types": "*",
33 | "@types/scheduler": "*",
34 | "csstype": "^3.0.2"
35 | }
36 | },
37 | "node_modules/@types/scheduler": {
38 | "version": "0.16.2",
39 | "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
40 | "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
41 | "dev": true
42 | },
43 | "node_modules/csstype": {
44 | "version": "3.0.10",
45 | "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz",
46 | "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==",
47 | "dev": true
48 | },
49 | "node_modules/js-tokens": {
50 | "version": "4.0.0",
51 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
52 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
53 | "dev": true
54 | },
55 | "node_modules/loose-envify": {
56 | "version": "1.4.0",
57 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
58 | "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
59 | "dev": true,
60 | "dependencies": {
61 | "js-tokens": "^3.0.0 || ^4.0.0"
62 | },
63 | "bin": {
64 | "loose-envify": "cli.js"
65 | }
66 | },
67 | "node_modules/object-assign": {
68 | "version": "4.1.1",
69 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
70 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
71 | "dev": true,
72 | "engines": {
73 | "node": ">=0.10.0"
74 | }
75 | },
76 | "node_modules/react": {
77 | "version": "17.0.2",
78 | "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
79 | "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
80 | "dev": true,
81 | "dependencies": {
82 | "loose-envify": "^1.1.0",
83 | "object-assign": "^4.1.1"
84 | },
85 | "engines": {
86 | "node": ">=0.10.0"
87 | }
88 | },
89 | "node_modules/typescript": {
90 | "version": "4.5.5",
91 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
92 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
93 | "dev": true,
94 | "bin": {
95 | "tsc": "bin/tsc",
96 | "tsserver": "bin/tsserver"
97 | },
98 | "engines": {
99 | "node": ">=4.2.0"
100 | }
101 | }
102 | },
103 | "dependencies": {
104 | "@types/prop-types": {
105 | "version": "15.7.4",
106 | "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz",
107 | "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==",
108 | "dev": true
109 | },
110 | "@types/react": {
111 | "version": "17.0.39",
112 | "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
113 | "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
114 | "dev": true,
115 | "requires": {
116 | "@types/prop-types": "*",
117 | "@types/scheduler": "*",
118 | "csstype": "^3.0.2"
119 | }
120 | },
121 | "@types/scheduler": {
122 | "version": "0.16.2",
123 | "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
124 | "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
125 | "dev": true
126 | },
127 | "csstype": {
128 | "version": "3.0.10",
129 | "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz",
130 | "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==",
131 | "dev": true
132 | },
133 | "js-tokens": {
134 | "version": "4.0.0",
135 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
136 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
137 | "dev": true
138 | },
139 | "loose-envify": {
140 | "version": "1.4.0",
141 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
142 | "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
143 | "dev": true,
144 | "requires": {
145 | "js-tokens": "^3.0.0 || ^4.0.0"
146 | }
147 | },
148 | "object-assign": {
149 | "version": "4.1.1",
150 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
151 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
152 | "dev": true
153 | },
154 | "react": {
155 | "version": "17.0.2",
156 | "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
157 | "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
158 | "dev": true,
159 | "requires": {
160 | "loose-envify": "^1.1.0",
161 | "object-assign": "^4.1.1"
162 | }
163 | },
164 | "typescript": {
165 | "version": "4.5.5",
166 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
167 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
168 | "dev": true
169 | }
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "minact",
3 | "description": "A simple react state management library without a provider",
4 | "version": "1.0.2",
5 | "main": "dist/index.js",
6 | "types": "dist",
7 | "scripts": {
8 | "build": "tsc -p .",
9 | "dev": "tsc -p . --watch"
10 | },
11 | "devDependencies": {
12 | "@types/react": "^17.0.39",
13 | "react": "^17.0.2",
14 | "typescript": "^4.5.5"
15 | },
16 | "peerDependencies": {
17 | "react": ">=17.0.2"
18 | },
19 | "keywords": [
20 | "minact",
21 | "react",
22 | "min act",
23 | "state management"
24 | ],
25 | "author": "napthedev",
26 | "license": "MIT",
27 | "repository": {
28 | "type": "git",
29 | "url": "https://github.com/napthedev/minact.git"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 |
3 | export const createStore = <
4 | X extends { [key: string]: any },
5 | Y extends (set: Function, get: Function) => { [key: string]: Function }
6 | >(
7 | initialState: X,
8 | initialReducers: Y
9 | ) => {
10 | let listeners: Function[] = [];
11 |
12 | let state = initialState;
13 |
14 | const set = (changer: { [key: string]: any }) => {
15 | state = { ...state, ...changer };
16 |
17 | listeners.forEach((listener) => listener());
18 | };
19 |
20 | const get = () => {
21 | return state;
22 | };
23 |
24 | let reducers = initialReducers(set, get) as ReturnType;
25 |
26 | const useSelector = (selector: (state: X) => any) => {
27 | const [selected, setSelected] = useState(selector(state));
28 |
29 | useEffect(() => {
30 | listeners.push(() => {
31 | const newSelected = selector(state);
32 | setSelected(newSelected);
33 | });
34 | }, []);
35 |
36 | return selected;
37 | };
38 |
39 | const subscribe = (listener: Function) => {
40 | listeners.push(listener);
41 |
42 | return () => {
43 | listeners = listeners.filter((item) => item !== listener);
44 | };
45 | };
46 |
47 | const useDispatch = (selector: (reducers: ReturnType) => any) => {
48 | const selected = selector(reducers);
49 |
50 | return selected;
51 | };
52 |
53 | return { useSelector, useDispatch, subscribe, get };
54 | };
55 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Projects */
6 | // "incremental": true, /* Enable incremental compilation */
7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12 |
13 | /* Language and Environment */
14 | "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16 | "jsx": "react-jsx" /* Specify what JSX code is generated. */,
17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21 | "jsxImportSource": "react" /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */,
22 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25 |
26 | /* Modules */
27 | "module": "ES6" /* Specify what module code is generated. */,
28 | "rootDir": "./src" /* Specify the root folder within your source files. */,
29 | "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
30 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36 | // "resolveJsonModule": true, /* Enable importing .json files */
37 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */
38 |
39 | /* JavaScript Support */
40 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43 |
44 | /* Emit */
45 | "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
46 | "declarationMap": true /* Create sourcemaps for d.ts files. */,
47 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48 | "sourceMap": true /* Create source map files for emitted JavaScript files. */,
49 | // "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. */
50 | "outDir": "./dist" /* Specify an output folder for all emitted files. */,
51 | // "removeComments": true, /* Disable emitting comments. */
52 | // "noEmit": true, /* Disable emitting files from a compilation. */
53 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61 | // "newLine": "crlf", /* Set the newline character for emitting files. */
62 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
68 |
69 | /* Interop Constraints */
70 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
71 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
72 | "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
73 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74 | "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
75 |
76 | /* Type Checking */
77 | "strict": true /* Enable all strict type-checking options. */,
78 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
96 |
97 | /* Completeness */
98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */
100 | }
101 | }
102 |
--------------------------------------------------------------------------------