egg 3.14.0 → 3.14.2

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.
Files changed (2) hide show
  1. package/index.d.ts +12 -10
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -19,9 +19,9 @@ import {
19
19
  HttpClientResponse as HttpClientResponseOld,
20
20
  } from 'urllib';
21
21
  import {
22
- RequestURL,
23
- RequestOptions as RequestOptionsNext,
24
- HttpClientResponse as HttpClientResponseNext,
22
+ RequestURL as HttpClientRequestURL,
23
+ RequestOptions as HttpClientRequestOptions,
24
+ HttpClientResponse,
25
25
  } from 'urllib-next';
26
26
  import {
27
27
  EggCoreBase,
@@ -60,10 +60,7 @@ declare module 'egg' {
60
60
  // return await app.httpclient.request(url, options);
61
61
  // }
62
62
  // ```
63
- export type HttpClientRequestURL = RequestURL;
64
- export type HttpClientRequestOptions = RequestOptionsNext;
65
- export type HttpClientResponse<T = any> = HttpClientResponseNext<T>;
66
-
63
+ export { HttpClientRequestURL, HttpClientRequestOptions, HttpClientResponse };
67
64
  // Compatible with both urllib@2 and urllib@3 RequestOptions to request
68
65
  export interface EggHttpClient extends EventEmitter {
69
66
  request<T = any>(url: HttpClientRequestURL): Promise<HttpClientResponseOld<T> | HttpClientResponse<T>>;
@@ -549,7 +546,7 @@ declare module 'egg' {
549
546
  headers: { [key: string]: string };
550
547
  }
551
548
 
552
- export interface Router extends KoaRouter<any, Context> {
549
+ export interface Router extends Omit<KoaRouter<any, Context>, 'url'> {
553
550
  /**
554
551
  * restful router api
555
552
  */
@@ -557,7 +554,7 @@ declare module 'egg' {
557
554
 
558
555
  /**
559
556
  * @param {String} name - Router name
560
- * @param {Object} params - more parameters
557
+ * @param {Object} [params] - more parameters
561
558
  * @example
562
559
  * ```js
563
560
  * router.url('edit_post', { id: 1, name: 'foo', page: 2 })
@@ -568,7 +565,12 @@ declare module 'egg' {
568
565
  * @return {String} url by path name and query params.
569
566
  * @since 1.0.0
570
567
  */
571
- url(name: string, params: any): any;
568
+ url(name: string, params?: any): string;
569
+ /**
570
+ * Alias for the url method
571
+ */
572
+ pathFor(name: string, params?: any): string;
573
+ methods: string[];
572
574
  }
573
575
 
574
576
  export interface EggApplication extends EggCoreBase<EggAppConfig> { // tslint:disable-line
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "3.14.0",
3
+ "version": "3.14.2",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },