File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ import * as URL from "./urls";
3
3
import { toArray } from "./util" ;
4
4
5
5
export default class Client {
6
- public config : Line . Config ;
6
+ public config : Line . ClientConfig ;
7
7
8
- constructor ( config : Line . Config & { channelAccessToken : string } ) {
8
+ constructor ( config : Line . Config & Line . ClientConfig ) {
9
9
if ( ! config . channelAccessToken ) {
10
10
throw new Error ( "no channel access token" ) ;
11
11
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export type NextCallback = (err?: Error) => void;
9
9
10
10
export type Middleware = ( req : Request , res : Response , next : NextCallback ) => void ;
11
11
12
- export default function middleware ( config : Line . Config & { channelSecret : string } ) : Middleware {
12
+ export default function middleware ( config : Line . Config & Line . MiddlewareConfig ) : Middleware {
13
13
if ( ! config . channelSecret ) {
14
14
throw new Error ( "no channel secret" ) ;
15
15
}
Original file line number Diff line number Diff line change 5
5
declare module "got" ;
6
6
7
7
declare namespace Line {
8
- export type Config = {
9
- channelAccessToken ?: string ,
10
- channelSecret ?: string ,
8
+ export type ClientConfig = {
9
+ channelAccessToken : string ,
11
10
} ;
12
11
12
+ export type MiddlewareConfig = {
13
+ channelSecret : string ,
14
+ } ;
15
+
16
+ export type Config = ClientConfig | MiddlewareConfig ;
17
+
13
18
export type Profile = {
14
19
displayName : string ,
15
20
userId : string ,
You can’t perform that action at this time.
0 commit comments