diff --git a/src/index.d.ts b/index.d.ts similarity index 98% rename from src/index.d.ts rename to index.d.ts index 6ec793487a..11374fb62f 100644 --- a/src/index.d.ts +++ b/index.d.ts @@ -1,6 +1,6 @@ import accepts = require('accepts'); import { AsyncLocalStorage } from 'async_hooks'; -import { EventEmitter } from 'events' +import { EventEmitter } from 'events'; import { Readable } from 'stream'; import { Socket } from 'net'; import { IncomingMessage, ServerResponse } from 'http'; @@ -65,10 +65,10 @@ declare module 'egg' { export interface EggHttpClient extends EventEmitter { request(url: HttpClientRequestURL): Promise | HttpClientResponse>; request(url: HttpClientRequestURL, options: RequestOptionsOld | HttpClientRequestOptions): - Promise | HttpClientResponse>; + Promise | HttpClientResponse>; curl(url: HttpClientRequestURL): Promise | HttpClientResponse>; curl(url: HttpClientRequestURL, options: RequestOptionsOld | HttpClientRequestOptions): - Promise | HttpClientResponse>; + Promise | HttpClientResponse>; } interface EggHttpConstructor { @@ -723,13 +723,13 @@ declare module 'egg' { /** * Get current execute ctx async local storage - * @returns {AsyncLocalStorage} localStorage - store current execute Context + * @return {AsyncLocalStorage} localStorage - store current execute Context */ get ctxStorage(): AsyncLocalStorage; /** * Get current execute ctx, maybe undefined - * @returns {Context} ctx - current execute Context + * @return {Context} ctx - current execute Context */ get currentContext(): Context; } @@ -1001,7 +1001,7 @@ declare module 'egg' { * // get other fields * console.log(stream.fields); * ``` - * @method Context#getFileStream + * @function Context#getFileStream * @param {Object} options * @return {ReadStream} stream * @since 1.0.0 @@ -1052,7 +1052,7 @@ declare module 'egg' { export interface IHelper extends PlainObject, BaseContextClass { /** * Generate URL path(without host) for route. Takes the route name and a map of named params. - * @method Helper#pathFor + * @function Helper#pathFor * @param {String} name - Router Name * @param {Object} params - Other params * @@ -1068,7 +1068,7 @@ declare module 'egg' { /** * Generate full URL(with host) for route. Takes the route name and a map of named params. - * @method Helper#urlFor + * @function Helper#urlFor * @param {String} name - Router name * @param {Object} params - Other params * @example @@ -1153,7 +1153,7 @@ declare module 'egg' { ignoreWarning?: boolean; } - export function start(options?: StartOptions): Promise + export function start(options?: StartOptions): Promise; /** * Powerful Partial, Support adding ? modifier to a mapped property in deep level @@ -1165,8 +1165,8 @@ declare module 'egg' { */ export type PowerPartial = { [U in keyof T]?: T[U] extends object - ? PowerPartial - : T[U] + ? PowerPartial + : T[U] }; // send data can be number|string|boolean|object but not Set|Map diff --git a/package.json b/package.json index 4893d04f5f..2305b92856 100644 --- a/package.json +++ b/package.json @@ -81,20 +81,17 @@ "sdk-base": "^4.2.1", "spy": "^1.0.0", "supertest": "^6.2.4", - "tsd": "^0.31.1", "tshy": "^1.18.0", "tshy-after": "^1.1.1", - "typescript": "5", - "umi": "^3.5.36" + "typescript": "5" }, "scripts": { - "lint": "eslint app config lib test *.js", - "tsd": "tsd", - "pretest": "npm run lint -- --fix && npm run tsd", + "lint": "eslint src test --ext .ts", + "pretest": "npm run lint -- --fix", "test": "egg-bin test", "test:changed": "egg-bin test --changed", "cov": "egg-bin cov --timeout 100000", - "preci": "npm run lint && npm run tsd", + "preci": "npm run lint", "ci": "npm run cov && npm run prepublishOnly && attw --pack", "prepublishOnly": "tshy && tshy-after", "site:dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider APP_ROOT=./site dumi dev", diff --git a/src/config/config.local.ts b/src/config/config.local.ts index af29a4c62f..6ba0294b1a 100644 --- a/src/config/config.local.ts +++ b/src/config/config.local.ts @@ -8,4 +8,4 @@ export default () => { }, }, } satisfies Partial; -} +}; diff --git a/src/config/config.unittest.ts b/src/config/config.unittest.ts index 95eacc6ab5..3c16597396 100644 --- a/src/config/config.unittest.ts +++ b/src/config/config.unittest.ts @@ -7,4 +7,4 @@ export default () => { buffer: false, }, } satisfies Partial; -} +}; diff --git a/src/lib/egg.ts b/src/lib/egg.ts index 8cabdefd8a..012ad0fe09 100644 --- a/src/lib/egg.ts +++ b/src/lib/egg.ts @@ -302,7 +302,7 @@ export class EggApplication extends EggCore { * See https://github.com/node-modules/urllib#api-doc for more details. * * @param {String} url request url address. - * @param {Object} opts + * @param {Object} options * - method {String} - Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. * - data {Object} - Data to be sent. Will be stringify automatically. * - dataType {String} - String - Type of response data. Could be `text` or `json`.