Unverified 提交 2e2b3295 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi 提交者: GitHub

TypeScript fixes (#422)

- Use TS lib: ES2018 so we don't accidentally use JS API not supported by Node 10.
- Produce ES2018 code (target: ES2018) so it's suitable for Node 10.
- Fix property type to make sure TS can understand what it is without additional casting
上级 a6fb5aef
...@@ -359,7 +359,7 @@ export class Router extends EnhancedEventEmitter ...@@ -359,7 +359,7 @@ export class Router extends EnhancedEventEmitter
else if (appData && typeof appData !== 'object') else if (appData && typeof appData !== 'object')
throw new TypeError('if given, appData must be an object'); throw new TypeError('if given, appData must be an object');
listenIps = (listenIps as any[]).map((listenIp: TransportListenIp | string) => listenIps = listenIps.map((listenIp) =>
{ {
if (typeof listenIp === 'string' && listenIp) if (typeof listenIp === 'string' && listenIp)
{ {
......
...@@ -16,7 +16,7 @@ export type WebRtcTransportOptions = ...@@ -16,7 +16,7 @@ export type WebRtcTransportOptions =
* Listening IP address or addresses in order of preference (first one is the * Listening IP address or addresses in order of preference (first one is the
* preferred one). * preferred one).
*/ */
listenIps: TransportListenIp[] | string[]; listenIps: (TransportListenIp | string)[];
/** /**
* Listen in UDP. Default true. * Listen in UDP. Default true.
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"compileOnSave": true, "compileOnSave": true,
"compilerOptions": "compilerOptions":
{ {
"lib": [ "es2019" ], "lib": [ "es2018" ],
"target": "es2020", "target": "es2018",
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"strict": true, "strict": true,
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论