diff --git a/index.d.ts b/index.d.ts index 0bb462415c..3a2fde4ba6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -782,7 +782,12 @@ declare module 'egg' { params: any; /** - * @see Request#accept + * @see Request#query + */ + query: PlainObject; + + /** + * @see Request#queries */ queries: PlainObject; diff --git a/test/fixtures/apps/app-ts/app/controller/foo.ts b/test/fixtures/apps/app-ts/app/controller/foo.ts index 62e179aaf1..92c755c303 100644 --- a/test/fixtures/apps/app-ts/app/controller/foo.ts +++ b/test/fixtures/apps/app-ts/app/controller/foo.ts @@ -72,4 +72,20 @@ export default class FooController extends Controller { async testViewRenderString() { this.ctx.body = await this.ctx.view.renderString('test'); } + + async testQuery() { + this.stringQuery(this.ctx.query.foo); + } + + async testQueries() { + this.stringArrayQuery(this.ctx.queries.foo); + } + + stringQuery(q: string) { + console.log(q); + } + + stringArrayQuery(q: string[]) { + console.log(q); + } }