@elysiajs/jwt 0.1.0-rc.1 → 0.1.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,62 @@
1
+ import { type Elysia, type UnwrapSchema } from 'elysia';
2
+ import { type JWTPayload, type JWSHeaderParameters } from 'jose';
3
+ import type { TSchema } from '@sinclair/typebox';
4
+ export interface JWTPayloadSpec {
5
+ iss?: string;
6
+ sub?: string;
7
+ aud?: string | string[];
8
+ jti?: string;
9
+ nbf?: number;
10
+ exp?: number;
11
+ iat?: number;
12
+ }
13
+ export interface JWTOption<Name extends string = string, Schema extends TSchema | undefined = undefined> extends JWSHeaderParameters, Omit<JWTPayload, 'nbf' | 'exp'> {
14
+ /**
15
+ * Name to decorate method as
16
+ *
17
+ * ---
18
+ * @example
19
+ * For example, `jwt` will decorate Context with `Context.jwt`
20
+ *
21
+ * ```typescript
22
+ * app
23
+ * .decorate({
24
+ * name: 'myJWTNamespace',
25
+ * secret: process.env.JWT_SECRETS
26
+ * })
27
+ * .get('/sign/:name', ({ myJWTNamespace, params }) => {
28
+ * return myJWTNamespace.sign(params)
29
+ * })
30
+ * ```
31
+ */
32
+ name: Name;
33
+ /**
34
+ * JWT Secret
35
+ */
36
+ secret: string;
37
+ /**
38
+ * Type strict validation for JWT payload
39
+ */
40
+ schema?: Schema;
41
+ /**
42
+ * JWT Not Before
43
+ *
44
+ * @see [RFC7519#section-4.1.5](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5)
45
+ */
46
+ nbf?: string | number;
47
+ /**
48
+ * JWT Expiration Time
49
+ *
50
+ * @see [RFC7519#section-4.1.4](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4)
51
+ */
52
+ exp?: string | number;
53
+ }
54
+ export declare const jwt: <Name extends string = string, Schema extends TSchema | undefined = undefined>({ name, secret, alg, crit, schema, nbf, exp, ...payload }: JWTOption<Name, Schema>) => (app: Elysia) => Elysia<{
55
+ store: {};
56
+ request: { [key in Name]: {
57
+ sign: (morePayload: UnwrapSchema<Schema, Record<string, string>> & JWTPayloadSpec) => Promise<string>;
58
+ verify: (jwt?: string) => Promise<false | (UnwrapSchema<Schema, Record<string, string>> & JWTPayloadSpec)>;
59
+ }; };
60
+ schema: {};
61
+ }>;
62
+ export default jwt;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elysiajs/jwt",
3
3
  "description": "Plugin for Elysia for using JWT Authentication",
4
- "version": "0.1.0-rc.1",
4
+ "version": "0.1.0-rc.3",
5
5
  "author": {
6
6
  "name": "saltyAom",
7
7
  "url": "https://github.com/SaltyAom",
@@ -11,6 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/elysiajs/elysia-jwt"
13
13
  },
14
+ "main": "./dist/index.js",
14
15
  "exports": {
15
16
  "require": "./dist/cjs/index.js",
16
17
  "import": "./dist/index.js",
@@ -39,15 +40,15 @@
39
40
  "jose": "^4.11.1"
40
41
  },
41
42
  "devDependencies": {
42
- "@elysiajs/cookie": "^0.1.0-rc.1",
43
+ "@elysiajs/cookie": "^0.1.0-rc.2",
43
44
  "@sinclair/typebox": "0.25.10",
44
45
  "@types/node": "^18.11.7",
45
46
  "bun-types": "^0.2.2",
46
47
  "eslint": "^8.26.0",
47
- "elysia": "^0.1.0-rc.1",
48
+ "elysia": "^0.1.0-rc.5",
48
49
  "typescript": "^4.8.4"
49
50
  },
50
51
  "peerDependencies": {
51
- "elysia": ">= 0.1.0-rc.1"
52
+ "elysia": ">= 0.1.0-rc.5"
52
53
  }
53
54
  }
package/.eslintrc.js DELETED
@@ -1,23 +0,0 @@
1
- module.exports = {
2
- "env": {
3
- "es2021": true,
4
- "node": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:@typescript-eslint/recommended"
9
- ],
10
- "parser": "@typescript-eslint/parser",
11
- "parserOptions": {
12
- "ecmaVersion": "latest",
13
- "sourceType": "module"
14
- },
15
- "plugins": [
16
- "@typescript-eslint"
17
- ],
18
- "rules": {
19
- "@typescript-eslint/ban-types": 'off',
20
- '@typescript-eslint/no-explicit-any': 'off'
21
- },
22
- "ignorePatterns": ["example/*", "tests/**/*"]
23
- }
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # 0.1.0-rc.1 - 6 Dec 2022
2
- Improvement:
3
- - Support for Elysia 0.1.0-rc.1 onward
4
-
5
- # 0.0.0-experimental.1 - 30 Oct 2022
6
- Change:
7
- - Support for KingWorld 0.0.0-experimental.28 onward
8
- - chore: update dependencies
package/src/index.ts DELETED
@@ -1,162 +0,0 @@
1
- import {
2
- createValidationError,
3
- getSchemaValidator,
4
- type Elysia,
5
- type Context,
6
- type UnwrapSchema
7
- } from 'elysia'
8
-
9
- import {
10
- SignJWT,
11
- jwtVerify,
12
- type JWTPayload,
13
- type JWSHeaderParameters
14
- } from 'jose'
15
-
16
- import { Type as t } from '@sinclair/typebox'
17
- import type { Static, TObject, TSchema } from '@sinclair/typebox'
18
-
19
- export interface JWTPayloadSpec {
20
- iss?: string
21
- sub?: string
22
- aud?: string | string[]
23
- jti?: string
24
- nbf?: number
25
- exp?: number
26
- iat?: number
27
- }
28
-
29
- export interface JWTOption<
30
- Name extends string = string,
31
- Schema extends TSchema | undefined = undefined
32
- > extends JWSHeaderParameters,
33
- Omit<JWTPayload, 'nbf' | 'exp'> {
34
- /**
35
- * Name to decorate method as
36
- *
37
- * ---
38
- * @example
39
- * For example, `jwt` will decorate Context with `Context.jwt`
40
- *
41
- * ```typescript
42
- * app
43
- * .decorate({
44
- * name: 'myJWTNamespace',
45
- * secret: process.env.JWT_SECRETS
46
- * })
47
- * .get('/sign/:name', ({ myJWTNamespace, params }) => {
48
- * return myJWTNamespace.sign(params)
49
- * })
50
- * ```
51
- */
52
- name: Name
53
- /**
54
- * JWT Secret
55
- */
56
- secret: string
57
- /**
58
- * Type strict validation for JWT payload
59
- */
60
- schema?: Schema
61
-
62
- /**
63
- * JWT Not Before
64
- *
65
- * @see [RFC7519#section-4.1.5](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5)
66
- */
67
-
68
- nbf?: string | number
69
- /**
70
- * JWT Expiration Time
71
- *
72
- * @see [RFC7519#section-4.1.4](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4)
73
- */
74
- exp?: string | number
75
- }
76
-
77
- export const jwt =
78
- <
79
- Name extends string = string,
80
- Schema extends TSchema | undefined = undefined
81
- >({
82
- name,
83
- secret,
84
- // Start JWT Header
85
- alg = 'HS256',
86
- crit,
87
- schema,
88
- // End JWT Header
89
- // Start JWT Payload
90
- nbf,
91
- exp,
92
- ...payload
93
- }: // End JWT Payload
94
- JWTOption<Name, Schema>) =>
95
- (app: Elysia) => {
96
- if (!secret) throw new Error("Secret can't be empty")
97
-
98
- const key = new TextEncoder().encode(secret)
99
-
100
- const validator = schema
101
- ? getSchemaValidator(
102
- t.Union([
103
- schema,
104
- t.Object({
105
- iss: t.Optional(t.String()),
106
- sub: t.Optional(t.String()),
107
- aud: t.Optional(
108
- t.Union([t.String(), t.Array(t.String())])
109
- ),
110
- jti: t.Optional(t.String()),
111
- nbf: t.Optional(t.Union([t.String(), t.Number()])),
112
- exp: t.Optional(t.Union([t.String(), t.Number()])),
113
- iat: t.Optional(t.String())
114
- })
115
- ])
116
- )
117
- : undefined
118
-
119
- return app.decorate(name, {
120
- sign: (
121
- morePayload: UnwrapSchema<Schema, Record<string, string>> &
122
- JWTPayloadSpec
123
- ) => {
124
- let jwt = new SignJWT({
125
- ...payload,
126
- ...morePayload,
127
- nbf: undefined,
128
- exp: undefined
129
- }).setProtectedHeader({
130
- alg,
131
- crit
132
- })
133
-
134
- if (nbf) jwt = jwt.setNotBefore(nbf)
135
- if (exp) jwt = jwt.setExpirationTime(exp)
136
-
137
- return jwt.sign(key)
138
- },
139
- verify: async (
140
- jwt?: string
141
- ): Promise<
142
- | (UnwrapSchema<Schema, Record<string, string>> &
143
- JWTPayloadSpec)
144
- | false
145
- > => {
146
- if (!jwt) return false
147
-
148
- try {
149
- const data: any = (await jwtVerify(jwt, key)).payload
150
-
151
- if (validator && !validator!.Check(data))
152
- throw createValidationError('JWT', validator, data)
153
-
154
- return data
155
- } catch (_) {
156
- return false
157
- }
158
- }
159
- })
160
- }
161
-
162
- export default jwt
@@ -1,50 +0,0 @@
1
- import { Elysia, t } from 'elysia'
2
- import { jwt } from '../src'
3
-
4
- import { describe, expect, it } from 'bun:test'
5
-
6
- const req = (path: string) => new Request(path)
7
- const post = (path: string, body = {}) =>
8
- new Request(path, {
9
- method: 'POST',
10
- headers: {
11
- 'Content-Type': 'application/json'
12
- },
13
- body: JSON.stringify(body)
14
- })
15
-
16
- describe('Static Plugin', () => {
17
- it('sign JWT', async () => {
18
- const app = new Elysia()
19
- .use(
20
- jwt({
21
- name: 'jwt',
22
- secret: 'A'
23
- })
24
- )
25
- .post('/validate', ({ jwt, body }) => jwt.sign(body), {
26
- schema: {
27
- body: t.Object({
28
- name: t.String()
29
- })
30
- }
31
- })
32
- .post('/validate', ({ jwt, body: { name } }) => jwt.verify(name), {
33
- schema: {
34
- body: t.Object({ name: t.String() })
35
- }
36
- })
37
-
38
- const name = 'Shirokami'
39
-
40
- const _sign = post('/sign', { name })
41
- const token = await _sign.text()
42
-
43
- const _verified = post('/verify', { name })
44
- const signed = (await _verified.json()) as {
45
- name: string
46
- }
47
-
48
- expect(name).toBe(signed.name)
49
- })
50
- })
package/tsconfig.cjs.json DELETED
@@ -1,104 +0,0 @@
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": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": ["ESNext", "DOM", "ScriptHost"], /* 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": "./src", /* 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": "./src", /* 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": ["bun-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 '<reference>'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": false, /* 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/cjs", /* 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": false, /* 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
- "include": ["src/**/*"]
104
- }
package/tsconfig.esm.json DELETED
@@ -1,104 +0,0 @@
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": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": ["ESNext", "DOM", "ScriptHost"], /* 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": "ES2022", /* Specify what module code is generated. */
29
- // "rootDir": "./src", /* 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": "./src", /* 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": ["bun-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 '<reference>'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
- "include": ["src/**/*"]
104
- }