├── .eslintrc ├── .gitignore ├── .prettierignore ├── jest.config.ts ├── package-lock.json ├── package.json ├── prettier.config.js ├── src ├── __tests__ │ └── writer.ts └── index.ts └── tsconfig.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": ["@typescript-eslint", "sort-imports-es6-autofix"], 5 | "extends": [ 6 | "eslint:recommended", 7 | "plugin:@typescript-eslint/eslint-recommended", 8 | "plugin:@typescript-eslint/recommended" 9 | ], 10 | "rules": { 11 | "accessor-pairs": "error", 12 | "array-callback-return": "error", 13 | "default-case-last": "error", 14 | "default-param-last": "error", 15 | "dot-notation": "error", 16 | "eqeqeq": "error", 17 | "grouped-accessor-pairs": "error", 18 | "max-classes-per-file": "off", 19 | "no-caller": "error", 20 | "no-case-declarations": "error", 21 | "no-console": "error", 22 | "no-constructor-return": "error", 23 | "no-else-return": "off", 24 | "no-eq-null": "error", 25 | "no-eval": "error", 26 | "no-extend-native": "error", 27 | "no-extra-bind": "error", 28 | "no-extra-label": "off", 29 | "no-floating-decimal": "error", 30 | "no-implicit-globals": ["error", { "lexicalBindings": true }], 31 | "no-invalid-this": "error", 32 | "no-labels": "off", 33 | "no-lone-blocks": "error", 34 | "no-multi-spaces": "error", 35 | "no-new": "error", 36 | "no-new-func": "error", 37 | "no-new-wrappers": "error", 38 | "no-proto": "error", 39 | "no-redeclare": "error", 40 | "no-throw-literal": "error", 41 | "no-unreachable-loop": "error", 42 | "no-useless-call": "error", 43 | "no-useless-return": "off", 44 | "vars-on-top": "error", 45 | "sort-imports-es6-autofix/sort-imports-es6": [ 46 | "error", 47 | { 48 | "ignoreCase": false, 49 | "ignoreMemberSort": false, 50 | "memberSyntaxSortOrder": ["none", "all", "multiple", "single"] 51 | } 52 | ], 53 | "brace-style": ["error", "1tbs", { "allowSingleLine": false }], 54 | 55 | "@typescript-eslint/naming-convention": [ 56 | "warn", 57 | { 58 | "selector": "enumMember", 59 | "format": null, 60 | "custom": { 61 | "regex": "^[A-Z_][0-9A-Za-z_]+$", 62 | "match": true 63 | } 64 | } 65 | ], 66 | "consistent-return": "warn", 67 | "no-constant-condition": ["warn", { "checkLoops": false }], 68 | "@typescript-eslint/no-empty-function": "off", 69 | 70 | "curly": ["error", "all"], 71 | 72 | "@typescript-eslint/ban-ts-comment": "off", 73 | "@typescript-eslint/no-inferrable-types": "off", 74 | "@typescript-eslint/no-explicit-any": "off", 75 | "@typescript-eslint/no-unused-vars": 76 | [ 77 | "warn", 78 | { 79 | "argsIgnorePattern": "^_", 80 | "varsIgnorePattern": "^_", 81 | "caughtErrorsIgnorePattern": "^_" 82 | } 83 | ], 84 | "no-fallthrough": "off" 85 | } 86 | } 87 | 88 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | *.json 2 | 3 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * For a detailed explanation regarding each configuration property and type check, visit: 3 | * https://jestjs.io/docs/configuration 4 | */ 5 | 6 | export default { 7 | // All imported modules in your tests should be mocked automatically 8 | // automock: false, 9 | 10 | // Stop running tests after `n` failures 11 | // bail: 0, 12 | 13 | // The directory where Jest should store its cached dependency information 14 | // cacheDirectory: "/tmp/jest_rs", 15 | 16 | // Automatically clear mock calls, instances, contexts and results before every test 17 | // clearMocks: false, 18 | 19 | // Indicates whether the coverage information should be collected while executing the test 20 | // collectCoverage: false, 21 | 22 | // An array of glob patterns indicating a set of files for which coverage information should be collected 23 | // collectCoverageFrom: undefined, 24 | 25 | // The directory where Jest should output its coverage files 26 | // coverageDirectory: undefined, 27 | 28 | // An array of regexp pattern strings used to skip coverage collection 29 | // coveragePathIgnorePatterns: [ 30 | // "/node_modules/" 31 | // ], 32 | 33 | // Indicates which provider should be used to instrument code for coverage 34 | // coverageProvider: "babel", 35 | 36 | // A list of reporter names that Jest uses when writing coverage reports 37 | // coverageReporters: [ 38 | // "json", 39 | // "text", 40 | // "lcov", 41 | // "clover" 42 | // ], 43 | 44 | // An object that configures minimum threshold enforcement for coverage results 45 | // coverageThreshold: undefined, 46 | 47 | // A path to a custom dependency extractor 48 | // dependencyExtractor: undefined, 49 | 50 | // Make calling deprecated APIs throw helpful error messages 51 | // errorOnDeprecated: false, 52 | 53 | // The default configuration for fake timers 54 | // fakeTimers: { 55 | // "enableGlobally": false 56 | // }, 57 | 58 | // Force coverage collection from ignored files using an array of glob patterns 59 | // forceCoverageMatch: [], 60 | 61 | // A path to a module which exports an async function that is triggered once before all test suites 62 | // globalSetup: undefined, 63 | 64 | // A path to a module which exports an async function that is triggered once after all test suites 65 | // globalTeardown: undefined, 66 | 67 | // A set of global variables that need to be available in all test environments 68 | // globals: {}, 69 | 70 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 71 | // maxWorkers: "50%", 72 | 73 | // An array of directory names to be searched recursively up from the requiring module's location 74 | // moduleDirectories: [ 75 | // "node_modules" 76 | // ], 77 | 78 | // An array of file extensions your modules use 79 | // moduleFileExtensions: [ 80 | // "js", 81 | // "mjs", 82 | // "cjs", 83 | // "jsx", 84 | // "ts", 85 | // "tsx", 86 | // "json", 87 | // "node" 88 | // ], 89 | 90 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module 91 | // moduleNameMapper: {}, 92 | 93 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 94 | // modulePathIgnorePatterns: [], 95 | 96 | // Activates notifications for test results 97 | // notify: false, 98 | 99 | // An enum that specifies notification mode. Requires { notify: true } 100 | // notifyMode: "failure-change", 101 | 102 | // A preset that is used as a base for Jest's configuration 103 | preset: "ts-jest", 104 | 105 | // Run tests from one or more projects 106 | // projects: undefined, 107 | 108 | // Use this configuration option to add custom reporters to Jest 109 | // reporters: undefined, 110 | 111 | // Automatically reset mock state before every test 112 | // resetMocks: false, 113 | 114 | // Reset the module registry before running each individual test 115 | // resetModules: false, 116 | 117 | // A path to a custom resolver 118 | // resolver: undefined, 119 | 120 | // Automatically restore mock state and implementation before every test 121 | // restoreMocks: false, 122 | 123 | // The root directory that Jest should scan for tests and modules within 124 | // rootDir: undefined, 125 | 126 | // A list of paths to directories that Jest should use to search for files in 127 | // roots: [ 128 | // "" 129 | // ], 130 | 131 | // Allows you to use a custom runner instead of Jest's default test runner 132 | // runner: "jest-runner", 133 | 134 | // The paths to modules that run some code to configure or set up the testing environment before each test 135 | // setupFiles: [], 136 | 137 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 138 | // setupFilesAfterEnv: [], 139 | 140 | // The number of seconds after which a test is considered as slow and reported as such in the results. 141 | // slowTestThreshold: 5, 142 | 143 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 144 | // snapshotSerializers: [], 145 | 146 | // The test environment that will be used for testing 147 | // testEnvironment: "jest-environment-node", 148 | 149 | // Options that will be passed to the testEnvironment 150 | // testEnvironmentOptions: {}, 151 | 152 | // Adds a location field to test results 153 | // testLocationInResults: false, 154 | 155 | // The glob patterns Jest uses to detect test files 156 | // testMatch: [ 157 | // "**/__tests__/**/*.[jt]s?(x)", 158 | // "**/?(*.)+(spec|test).[tj]s?(x)" 159 | // ], 160 | 161 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 162 | // testPathIgnorePatterns: [ 163 | // "/node_modules/" 164 | // ], 165 | 166 | // The regexp pattern or array of patterns that Jest uses to detect test files 167 | // testRegex: [], 168 | 169 | // This option allows the use of a custom results processor 170 | // testResultsProcessor: undefined, 171 | 172 | // This option allows use of a custom test runner 173 | // testRunner: "jest-circus/runner", 174 | 175 | // A map from regular expressions to paths to transformers 176 | // transform: undefined, 177 | 178 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 179 | // transformIgnorePatterns: [ 180 | // "/node_modules/", 181 | // "\\.pnp\\.[^\\/]+$" 182 | // ], 183 | 184 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 185 | // unmockedModulePathPatterns: undefined, 186 | 187 | // Indicates whether each individual test should be reported during the run 188 | // verbose: undefined, 189 | 190 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 191 | // watchPathIgnorePatterns: [], 192 | 193 | // Whether to use watchman for file crawling 194 | // watchman: true, 195 | }; 196 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@primeagen/memory-research", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/src/index.js", 6 | "scripts": { 7 | "test": "jest", 8 | "prettier": "prettier --write ./src", 9 | "lint": "eslint ./src --fix --ext .ts" 10 | }, 11 | "files": [ 12 | "dist/src/*.d.ts", 13 | "dist/src/*.js", 14 | "dist/src/*.map.js", 15 | "dist/src/**/*.d.ts", 16 | "dist/src/**/*.js", 17 | "dist/src/**/*.map.js" 18 | ], 19 | "keywords": [], 20 | "author": "", 21 | "license": "ISC", 22 | "devDependencies": { 23 | "@types/jest": "^29.5.1", 24 | "@types/node": "^18.16.3", 25 | "@typescript-eslint/eslint-plugin": "^5.59.2", 26 | "eslint": "^8.39.0", 27 | "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", 28 | "jest": "^29.5.0", 29 | "prettier": "^2.8.8", 30 | "ts-jest": "^29.1.0", 31 | "ts-node": "^10.9.1", 32 | "typescript": "^5.0.4" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | tabWidth: 4, 3 | printWidth: 80, 4 | proseWrap: "never", 5 | trailingComma: "all", 6 | singleQuote: false, 7 | semi: true, 8 | }; 9 | -------------------------------------------------------------------------------- /src/__tests__/writer.ts: -------------------------------------------------------------------------------- 1 | import Writer, { ArrayWriter, BufferStorage } from "../"; 2 | 3 | test("file-storage - one row, one column", async () => { 4 | const buffer = new BufferStorage(1000); 5 | const storage = new Writer(4, 1, buffer); 6 | await storage.open(); 7 | await storage.write("foo", 0, 0); 8 | const contents = await storage.close(); 9 | 10 | expect(contents.toString()).toBe(`foo \n`); 11 | }); 12 | 13 | test("file-storage - two row, one column", async () => { 14 | const buffer = new BufferStorage(1000); 15 | const storage = new Writer(4, 1, buffer); 16 | 17 | await storage.open(); 18 | await storage.write("foo", 1, 0); 19 | const contents = await storage.close(); 20 | const expected = ` \nfoo \n`; 21 | 22 | expect(contents.toString()).toBe(expected); 23 | }); 24 | 25 | test("file-storage - one row, two column", async () => { 26 | const buffer = new BufferStorage(1000); 27 | const storage = new Writer(4, 2, buffer); 28 | 29 | await storage.open(); 30 | await storage.write("foo", 1, 1); 31 | const contents = await storage.close(); 32 | const expected = ` , \n ,foo \n`; 33 | 34 | expect(contents.toString()).toBe(expected); 35 | }); 36 | 37 | test("file-storage - large", async () => { 38 | const buffer = new BufferStorage(1000); 39 | const storage = new Writer(4, 3, buffer); 40 | 41 | await storage.open(); 42 | await storage.write("foo", 3, 2); 43 | const contents = await storage.close(); 44 | const expected = ` , , \n , , \n , , \n , ,foo \n`; 45 | 46 | expect(contents.toString()).toBe(expected); 47 | }); 48 | 49 | test("array storage", async () => { 50 | const storage = new ArrayWriter(4); 51 | 52 | await storage.open(); 53 | await storage.write(123, 3, 2); 54 | const out = await storage.close(); 55 | const expected = [ 56 | [0, 0, 0, 0], 57 | [0, 0, 0, 0], 58 | [0, 0, 0, 0], 59 | [0, 0, 123, 0], 60 | ]; 61 | 62 | expect(out).toEqual(expected); 63 | }); 64 | 65 | test("array storage - add", async () => { 66 | const storage = new ArrayWriter(4); 67 | 68 | await storage.open(); 69 | await storage.add(123, 3, 2); 70 | await storage.add(456, 3, 2); 71 | const out = await storage.close(); 72 | const expected = [ 73 | [0, 0, 0, 0], 74 | [0, 0, 0, 0], 75 | [0, 0, 0, 0], 76 | [0, 0, 123 + 456, 0], 77 | ]; 78 | 79 | expect(out).toEqual(expected); 80 | }); 81 | 82 | test("array storage - forEach", async () => { 83 | const storage = new ArrayWriter(4); 84 | 85 | await storage.open(); 86 | await storage.add(123, 1, 3); 87 | 88 | storage.forEach((row, idx) => { 89 | if (idx === 1) { 90 | expect(row).toEqual([0, 0, 0, 123]); 91 | } else { 92 | expect(row).toEqual([0, 0, 0, 0]); 93 | } 94 | }); 95 | }); 96 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs/promises"; 2 | 3 | const whitespace = " ".charCodeAt(0); 4 | const comma = ",".charCodeAt(0); 5 | const newLine = "\n".charCodeAt(0); 6 | 7 | export interface IStorage { 8 | open(path?: string): Promise; 9 | close(): Promise; 10 | write(data: string, byteOffset: number): Promise; 11 | //add(data: string, row: number, column: number): Promise; 12 | } 13 | 14 | export interface IWriter { 15 | open(): Promise; 16 | close(): Promise; 17 | write(data: string | number, row: number, column: number): Promise; 18 | add(data: string | number, row: number, column: number): Promise; 19 | carryForwardColumn(column: number): Promise; 20 | forEach(callback: (columns: number[]) => void): Promise; 21 | } 22 | 23 | export class BufferStorage implements IStorage { 24 | private buffer: Buffer; 25 | private maxByteWritten = 0; 26 | 27 | constructor(private size: number) { 28 | this.buffer = Buffer.alloc(size, whitespace); 29 | } 30 | 31 | async open(): Promise {} 32 | 33 | async close(): Promise { 34 | return this.buffer.subarray(0, this.maxByteWritten); 35 | } 36 | 37 | async write(data: string | Buffer, byteOffset: number): Promise { 38 | if (this.size < byteOffset + data.length) { 39 | throw new Error( 40 | `initial buffer size of ${this.size} is too small to write ${data.length} bytes at ${byteOffset}`, 41 | ); 42 | } 43 | 44 | if (typeof data === "string") { 45 | this.buffer.write(data, byteOffset); 46 | } else { 47 | data.copy(this.buffer, byteOffset); 48 | } 49 | 50 | if (this.maxByteWritten < byteOffset + data.length) { 51 | this.maxByteWritten = byteOffset + data.length; 52 | } 53 | } 54 | } 55 | 56 | export class FileStorage implements IStorage { 57 | private file!: fs.FileHandle; 58 | private closed: boolean = true; 59 | 60 | async open(path?: string): Promise { 61 | if (!path) { 62 | throw new Error("FileStorage requires a path to be provide"); 63 | } 64 | 65 | this.closed = false; 66 | 67 | // TODO: Hydrate stats from file 68 | this.file = await fs.open(path, "w+"); 69 | } 70 | 71 | async close(): Promise { 72 | if (this.closed) { 73 | throw new Error("cannot close storage twice"); 74 | } 75 | await this.file.close(); 76 | } 77 | async write(data: string, byteOffset: number): Promise { 78 | if (this.closed) { 79 | throw new Error("cannot write a closed storage"); 80 | } 81 | await this.file.write(data, byteOffset); 82 | } 83 | } 84 | 85 | export default class Writer implements IWriter { 86 | private rowWidth: number; 87 | private maxRow; 88 | 89 | constructor( 90 | private cellWidth: number, 91 | private columns: number, 92 | private storage: IStorage = new BufferStorage(1024 * 1024), 93 | ) { 94 | this.rowWidth = 95 | // data space 96 | cellWidth * columns + 97 | // commas 98 | columns - 99 | 1 + 100 | // new line 101 | 1; 102 | 103 | this.maxRow = -1; 104 | } 105 | 106 | async add(_data: string, _row: number, _column: number): Promise { 107 | throw new Error("Method not implemented."); 108 | } 109 | async carryForwardColumn(_column: number): Promise { 110 | throw new Error("Method not implemented."); 111 | } 112 | async forEach(_callback: (_columns: number[]) => void): Promise { 113 | throw new Error("Method not implemented."); 114 | } 115 | 116 | async open(path?: string): Promise { 117 | await this.storage.open(path); 118 | } 119 | 120 | async close(): Promise { 121 | return this.storage.close() as T; 122 | } 123 | 124 | async write( 125 | data: string | number, 126 | row: number, 127 | column: number, 128 | ): Promise { 129 | data = data.toString(); 130 | 131 | this.grow(row); 132 | 133 | if (data.length > this.cellWidth) { 134 | throw new Error("unable to insert data"); 135 | } 136 | 137 | const rowOffset = row * this.rowWidth; 138 | const columnOffset = column * this.cellWidth + column; 139 | 140 | await this.storage.write(data, rowOffset + columnOffset); 141 | } 142 | 143 | private async grow(to: number): Promise { 144 | if (to <= this.maxRow) { 145 | return; 146 | } 147 | 148 | const amount = to - this.maxRow; 149 | const bytes = Buffer.alloc(this.rowWidth * amount).fill(whitespace); 150 | 151 | for (let i = 0; i < amount; ++i) { 152 | for (let j = 1; j < this.columns; ++j) { 153 | bytes.writeUInt8( 154 | comma, 155 | i * this.rowWidth + j * this.cellWidth + j - 1, 156 | ); 157 | } 158 | bytes.writeUInt8(newLine, i * this.rowWidth + this.rowWidth - 1); 159 | } 160 | 161 | // interface to write is better with string than buffer 162 | const toWrite = bytes.toString("utf-8"); 163 | 164 | await this.storage.write(toWrite, (this.maxRow + 1) * this.rowWidth); 165 | this.maxRow = amount; 166 | } 167 | } 168 | 169 | export class ArrayWriter implements IWriter { 170 | private view: Float64Array; 171 | private maxRow: number = -1; 172 | constructor(private columnCount: number) { 173 | this.view = new Float64Array(columnCount * 10); 174 | } 175 | 176 | async forEach( 177 | callback: (columns: number[], row: number) => void, 178 | ): Promise { 179 | for (let i = 0; i <= this.maxRow; ++i) { 180 | callback(this.getRow(i), i); 181 | } 182 | } 183 | 184 | async open(): Promise {} 185 | 186 | async close(): Promise { 187 | const out: number[][] = []; 188 | for (let i = 0; i <= this.maxRow; ++i) { 189 | out.push(this.getRow(i)); 190 | } 191 | return out; 192 | } 193 | 194 | async write( 195 | d: string | number, 196 | row: number, 197 | column: number, 198 | ): Promise { 199 | const data = +d; 200 | if (this.maxRow < row) { 201 | this.maxRow = row; 202 | } 203 | this.grow(row); 204 | this.view[this.offset(row, column)] = data; 205 | } 206 | 207 | async add(d: string | number, row: number, column: number): Promise { 208 | const data = +d; 209 | if (this.maxRow < row) { 210 | this.maxRow = row; 211 | } 212 | this.grow(row); 213 | this.view[this.offset(row, column)] += data; 214 | } 215 | 216 | async carryForwardColumn(column: number): Promise { 217 | let previous: number = 0; 218 | for (let i = 0; i < this.maxRow; ++i) { 219 | const offset = this.offset(i, column); 220 | const curr = this.view[offset]; 221 | if (previous === 0) { 222 | previous = curr; 223 | } else if (curr === 0 && previous !== 0) { 224 | this.view[offset] = previous; 225 | } else { 226 | previous = curr; 227 | } 228 | } 229 | } 230 | 231 | private offset(row: number, column: number): number { 232 | return row * this.columnCount + column; 233 | } 234 | 235 | private grow(row: number): void { 236 | const offset = this.offset(row, 0); 237 | 238 | if (offset < this.view.length) { 239 | return; 240 | } 241 | 242 | const newView = new Float64Array(this.view.length * 2); 243 | newView.set(this.view); 244 | } 245 | 246 | private getRow(r: number): number[] { 247 | const row: number[] = []; 248 | for (let col = 0; col < this.columnCount; ++col) { 249 | row.push(this.view[this.offset(r, col)]); 250 | } 251 | return row; 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 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": "esnext", /* 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": "preserve", /* 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": "", /* 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 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "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. */ 52 | "outDir": "dist", /* Specify an output folder for all emitted files. */ 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | 78 | /* Type Checking */ 79 | "strict": true, /* Enable all strict type-checking options. */ 80 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 81 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 82 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 83 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 84 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 85 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 86 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 87 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 88 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 89 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 90 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 91 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 92 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 93 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 94 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 95 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 96 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 97 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 98 | 99 | /* Completeness */ 100 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 101 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 102 | } 103 | } 104 | --------------------------------------------------------------------------------