kitty-agent 1.0.0
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.
- package/package.json +19 -0
- package/src/index.ts +311 -0
- package/tsconfig.json +111 -0
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kitty-agent",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Helpers for @atcute/client",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@atcute/client": "^2.0.6"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@atcute/client": "^2.0.6"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
|
+
|
|
3
|
+
import { XRPC, XRPCError, type XRPCOptions, type XRPCRequestOptions, type XRPCResponse } from "@atcute/client";
|
|
4
|
+
import type { At, ComAtprotoRepoApplyWrites, ComAtprotoRepoCreateRecord, ComAtprotoRepoDeleteRecord, ComAtprotoRepoGetRecord, ComAtprotoRepoListRecords, ComAtprotoRepoPutRecord, ComAtprotoSyncGetBlob, ComAtprotoSyncListBlobs, ComAtprotoSyncListRepos, Procedures, Queries, Records } from "@atcute/client/lexicons";
|
|
5
|
+
|
|
6
|
+
interface GetRecordParams<K extends keyof Records> extends ComAtprotoRepoGetRecord.Params { collection: K; }
|
|
7
|
+
interface GetRecordOutput<K extends keyof Records> extends ComAtprotoRepoGetRecord.Output { value: Records[K]; }
|
|
8
|
+
|
|
9
|
+
interface PutRecordParams<K extends keyof Records> extends ComAtprotoRepoPutRecord.Input { collection: K; record: Records[K]; }
|
|
10
|
+
interface PutRecordOutput<K extends keyof Records> extends ComAtprotoRepoPutRecord.Output { }
|
|
11
|
+
|
|
12
|
+
interface CreateRecordParams<K extends keyof Records> extends ComAtprotoRepoCreateRecord.Input { collection: K; record: Records[K]; }
|
|
13
|
+
interface CreateRecordOutput<K extends keyof Records> extends ComAtprotoRepoCreateRecord.Output { }
|
|
14
|
+
|
|
15
|
+
interface ListRecordsParams<K extends keyof Records> extends ComAtprotoRepoListRecords.Params { collection: K; }
|
|
16
|
+
interface ListRecordsOutput<K extends keyof Records> extends ComAtprotoRepoListRecords.Output { records: ListRecordsRecord<K>[]; }
|
|
17
|
+
interface ListRecordsRecord<K extends keyof Records> extends ComAtprotoRepoListRecords.Record { value: Records[K]; }
|
|
18
|
+
|
|
19
|
+
export function isInvalidSwapError(err: unknown) {
|
|
20
|
+
return err instanceof XRPCError && err.kind === 'InvalidSwap';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isRecordNotFoundError(err: unknown) {
|
|
24
|
+
return err instanceof XRPCError && err.kind === 'RecordNotFound';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type OutputOf<T> = T extends { output: infer U; } ? U : void;
|
|
28
|
+
|
|
29
|
+
// WARNING: Evil TypeScript crimes
|
|
30
|
+
// This spread array nonsense allows .query and .call to have 1-3
|
|
31
|
+
// parameters based on only the generic type.
|
|
32
|
+
//
|
|
33
|
+
// This cannot be done with overloads to my knowledge.
|
|
34
|
+
type ParamsThenData<T>
|
|
35
|
+
= T extends { params: infer U }
|
|
36
|
+
? T extends { input: infer V }
|
|
37
|
+
? [params: U, data: V]
|
|
38
|
+
: [params: U]
|
|
39
|
+
: T extends { input: infer W }
|
|
40
|
+
? [params: undefined, data: W]
|
|
41
|
+
: [];
|
|
42
|
+
|
|
43
|
+
type DataThenParams<T>
|
|
44
|
+
= T extends { input: infer U }
|
|
45
|
+
? T extends { params: infer V }
|
|
46
|
+
? [data: U, params: V]
|
|
47
|
+
: [data: U]
|
|
48
|
+
: T extends { params: infer W }
|
|
49
|
+
? [data: undefined, params: W]
|
|
50
|
+
: [];
|
|
51
|
+
|
|
52
|
+
export class KittyAgent<X extends XRPC = XRPC> {
|
|
53
|
+
public readonly xrpc: X;
|
|
54
|
+
|
|
55
|
+
constructor(opts: XRPCOptions | X) {
|
|
56
|
+
this.xrpc = opts instanceof XRPC ? opts as X : new XRPC(opts) as X;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Makes a request to the XRPC service */
|
|
60
|
+
async request(options: XRPCRequestOptions): Promise<XRPCResponse> {
|
|
61
|
+
return await this.xrpc.request(options);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async query<K extends keyof Queries>(
|
|
65
|
+
nsid: K,
|
|
66
|
+
...args: ParamsThenData<Queries[K]>
|
|
67
|
+
): Promise<OutputOf<Queries[K]>> {
|
|
68
|
+
const [params, data] = args as unknown[];
|
|
69
|
+
|
|
70
|
+
const { data: outData } = await this.xrpc.get(nsid, { params, data, } as any);
|
|
71
|
+
|
|
72
|
+
return outData;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async call<K extends keyof Procedures>(
|
|
76
|
+
nsid: K,
|
|
77
|
+
...args: DataThenParams<Procedures[K]>
|
|
78
|
+
): Promise<OutputOf<Procedures[K]>> {
|
|
79
|
+
const [data, params] = args as unknown[];
|
|
80
|
+
|
|
81
|
+
const { data: outData } = await this.xrpc.call(nsid, { params, data } as any);
|
|
82
|
+
|
|
83
|
+
return outData;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async get<K extends keyof Records>(params: GetRecordParams<K>) {
|
|
87
|
+
const data = await this.query('com.atproto.repo.getRecord', params);
|
|
88
|
+
|
|
89
|
+
return data as GetRecordOutput<K>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getBlob(params: ComAtprotoSyncGetBlob.Params | { did: At.DID, cid: At.Blob }): Promise<Uint8Array> {
|
|
93
|
+
if (typeof params.cid !== 'string') {
|
|
94
|
+
params = {
|
|
95
|
+
cid: params.cid.ref.$link as At.CID,
|
|
96
|
+
did: params.did,
|
|
97
|
+
} satisfies ComAtprotoSyncGetBlob.Params;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const data = await this.query('com.atproto.sync.getBlob', params as ComAtprotoSyncGetBlob.Params);
|
|
101
|
+
|
|
102
|
+
return data;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async tryGet<K extends keyof Records>(params: GetRecordParams<K>) {
|
|
106
|
+
try {
|
|
107
|
+
return await this.get(params);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (!isRecordNotFoundError(err)) throw err;
|
|
110
|
+
return {
|
|
111
|
+
uri: undefined,
|
|
112
|
+
value: undefined,
|
|
113
|
+
cid: undefined,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async list<K extends keyof Records>(params: ListRecordsParams<K>) {
|
|
119
|
+
const data = await this.query('com.atproto.repo.listRecords', params);
|
|
120
|
+
|
|
121
|
+
return data as ListRecordsOutput<K>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async put<K extends keyof Records>(params: PutRecordParams<K>) {
|
|
125
|
+
const data = await this.call('com.atproto.repo.putRecord', params);
|
|
126
|
+
|
|
127
|
+
return data as PutRecordOutput<K>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async uploadBlob(buf: Uint8Array | Blob) {
|
|
131
|
+
const data = await this.call('com.atproto.repo.uploadBlob', buf);
|
|
132
|
+
|
|
133
|
+
return data.blob;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async trySwap<K extends keyof Records>(params: PutRecordParams<K>) {
|
|
137
|
+
try {
|
|
138
|
+
await this.put(params);
|
|
139
|
+
return true;
|
|
140
|
+
} catch (err) {
|
|
141
|
+
if (!isInvalidSwapError(err)) {
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async create<K extends keyof Records>(params: CreateRecordParams<K>) {
|
|
149
|
+
const data = await this.call('com.atproto.repo.createRecord', params);
|
|
150
|
+
|
|
151
|
+
return data as CreateRecordOutput<K>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async delete(params: ComAtprotoRepoDeleteRecord.Input) {
|
|
155
|
+
const data = await this.call('com.atproto.repo.deleteRecord', params);
|
|
156
|
+
|
|
157
|
+
return data;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async paginatedList<K extends keyof Records>(params: {
|
|
161
|
+
repo: string,
|
|
162
|
+
collection: K,
|
|
163
|
+
reverse?: boolean,
|
|
164
|
+
limit?: number;
|
|
165
|
+
}): Promise<ListRecordsOutput<K>> {
|
|
166
|
+
const PER_PAGE = 100;
|
|
167
|
+
|
|
168
|
+
const results: ListRecordsRecord<K>[] = [];
|
|
169
|
+
|
|
170
|
+
let limit = params.limit;
|
|
171
|
+
|
|
172
|
+
let cursor: string | undefined = undefined;
|
|
173
|
+
do {
|
|
174
|
+
const data: ComAtprotoRepoListRecords.Output
|
|
175
|
+
= await this.query('com.atproto.repo.listRecords', {
|
|
176
|
+
repo: params.repo,
|
|
177
|
+
collection: params.collection,
|
|
178
|
+
limit: limit === undefined
|
|
179
|
+
? PER_PAGE
|
|
180
|
+
: limit / PER_PAGE > 1
|
|
181
|
+
? PER_PAGE
|
|
182
|
+
: limit,
|
|
183
|
+
reverse: params.reverse ?? true,
|
|
184
|
+
cursor
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (!data.records.length ||
|
|
188
|
+
data.records.every(
|
|
189
|
+
e => results.find(e1 => e1.uri == e.uri)
|
|
190
|
+
)
|
|
191
|
+
) {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (limit !== undefined) {
|
|
196
|
+
limit -= data.records.length;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
results.push(...data.records as ListRecordsRecord<K>[]);
|
|
200
|
+
|
|
201
|
+
cursor = data.cursor;
|
|
202
|
+
|
|
203
|
+
if (!cursor) break;
|
|
204
|
+
} while (cursor);
|
|
205
|
+
|
|
206
|
+
return { records: results, cursor };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async paginatedListBlobs(params: {
|
|
210
|
+
did: At.DID,
|
|
211
|
+
limit?: number;
|
|
212
|
+
}) {
|
|
213
|
+
const PER_PAGE = 1000;
|
|
214
|
+
|
|
215
|
+
const cids: string[] = [];
|
|
216
|
+
|
|
217
|
+
let limit = params.limit;
|
|
218
|
+
|
|
219
|
+
let cursor: string | undefined = undefined;
|
|
220
|
+
do {
|
|
221
|
+
const data: ComAtprotoSyncListBlobs.Output
|
|
222
|
+
= await this.query('com.atproto.sync.listBlobs', {
|
|
223
|
+
did: params.did,
|
|
224
|
+
limit: limit === undefined
|
|
225
|
+
? PER_PAGE
|
|
226
|
+
: limit / PER_PAGE > 1
|
|
227
|
+
? PER_PAGE
|
|
228
|
+
: limit,
|
|
229
|
+
cursor
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
if (!data.cids.length ||
|
|
233
|
+
data.cids.every(
|
|
234
|
+
e => cids.find(e1 => e1 == e)
|
|
235
|
+
)
|
|
236
|
+
) {
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (limit !== undefined) {
|
|
241
|
+
limit -= data.cids.length;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
cids.push(...data.cids);
|
|
245
|
+
|
|
246
|
+
cursor = data.cursor;
|
|
247
|
+
|
|
248
|
+
if (!cursor) break;
|
|
249
|
+
} while (cursor);
|
|
250
|
+
|
|
251
|
+
return { cids, cursor };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async paginatedListRepos(params: {
|
|
255
|
+
did: At.DID,
|
|
256
|
+
limit?: number;
|
|
257
|
+
}) {
|
|
258
|
+
const PER_PAGE = 1000;
|
|
259
|
+
|
|
260
|
+
const repos: ComAtprotoSyncListRepos.Repo[] = [];
|
|
261
|
+
|
|
262
|
+
let limit = params.limit;
|
|
263
|
+
|
|
264
|
+
let cursor: string | undefined = undefined;
|
|
265
|
+
do {
|
|
266
|
+
const data: ComAtprotoSyncListRepos.Output
|
|
267
|
+
= await this.query('com.atproto.sync.listRepos', {
|
|
268
|
+
limit: limit === undefined
|
|
269
|
+
? PER_PAGE
|
|
270
|
+
: limit / PER_PAGE > 1
|
|
271
|
+
? PER_PAGE
|
|
272
|
+
: limit,
|
|
273
|
+
cursor
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
if (!data.repos.length ||
|
|
277
|
+
data.repos.every(
|
|
278
|
+
e => repos.find(e1 => e1.did == e.did)
|
|
279
|
+
)
|
|
280
|
+
) {
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (limit !== undefined) {
|
|
285
|
+
limit -= data.repos.length;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
repos.push(...data.repos);
|
|
289
|
+
|
|
290
|
+
cursor = data.cursor;
|
|
291
|
+
|
|
292
|
+
if (!cursor) break;
|
|
293
|
+
} while (cursor);
|
|
294
|
+
|
|
295
|
+
return { repos, cursor };
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async batchWrite(params: ComAtprotoRepoApplyWrites.Input) {
|
|
299
|
+
return await this.call('com.atproto.repo.applyWrites', params);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async resolveHandle(handle: string): Promise<At.DID> {
|
|
303
|
+
if (handle.startsWith('did:')) return handle as At.DID;
|
|
304
|
+
|
|
305
|
+
const { did } = await this.query('com.atproto.identity.resolveHandle', {
|
|
306
|
+
handle
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
return did;
|
|
310
|
+
}
|
|
311
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
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": "ES2022", /* 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 legacy experimental 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": "NodeNext", /* Specify what module code is generated. */
|
|
29
|
+
"rootDir": "./src", /* Specify the root folder within your source files. */
|
|
30
|
+
"moduleResolution": "nodenext", /* 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
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
40
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
41
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
42
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
43
|
+
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
44
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
45
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
+
|
|
48
|
+
/* JavaScript Support */
|
|
49
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
+
|
|
53
|
+
/* Emit */
|
|
54
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
55
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
56
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
60
|
+
// "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. */
|
|
61
|
+
"outDir": "./out", /* Specify an output folder for all emitted files. */
|
|
62
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
63
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
65
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
66
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
67
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
68
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
69
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
70
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
71
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
72
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
73
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
74
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
75
|
+
|
|
76
|
+
/* Interop Constraints */
|
|
77
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
80
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
81
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
82
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
83
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
84
|
+
|
|
85
|
+
/* Type Checking */
|
|
86
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
87
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
88
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
89
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
90
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
91
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
92
|
+
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
93
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
102
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
+
|
|
107
|
+
/* Completeness */
|
|
108
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
+
}
|
|
111
|
+
}
|