Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: fix query typing (#4611)
  • Loading branch information
killagu committed Feb 18, 2021
1 parent 26017ee commit 99682e4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.d.ts
Expand Up @@ -782,7 +782,12 @@ declare module 'egg' {
params: any;

/**
* @see Request#accept
* @see Request#query
*/
query: PlainObject<string>;

/**
* @see Request#queries
*/
queries: PlainObject<string[]>;

Expand Down
16 changes: 16 additions & 0 deletions test/fixtures/apps/app-ts/app/controller/foo.ts
Expand Up @@ -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);
}
}

0 comments on commit 99682e4

Please sign in to comment.