我重新在ionic 4下尝试官方文档,这回把var AV =....换成import * as AV from 'leancloud-storage';这样就能通过编译了。但是同样办法在ionic 3下就会报错,而我的代码都是ionic 3写的。报错信息这回和leancloud有关,下面是VS code提示代码。
[app-scripts] [07:48:55] typescript: node_modules/leancloud-realtime/realtime.d.ts, line: 552
[app-scripts] ';' expected.
[app-scripts] L552: declare type EventContext = K extends keyof OptionalContext
[app-scripts] L553: ? OptionalContext[K]
[app-scripts] [07:48:55] typescript: node_modules/leancloud-realtime/realtime.d.ts, line: 552
[app-scripts] ';' expected.
[app-scripts] L552: declare type EventContext = K extends keyof OptionalContext
[app-scripts] L553: ? OptionalContext[K]
[app-scripts] [07:48:55] typescript: node_modules/leancloud-realtime/realtime.d.ts, line: 93
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L92: listener: (payload?: ClientEvent[K]) => any,
[app-scripts] L93: ...context: EventContext
[app-scripts] L94: ): this;
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L99: conversaion?: ConversationBase,
[app-scripts] L100: ...context: EventContext
[app-scripts] L101: ) => any
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L104: event: K,
[app-scripts] L105: listener: (payload?: ClientEvent[K], ...context: EventContext) => any
[app-scripts] L106: ): this;
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L111: conversaion?: ConversationBase,
[app-scripts] L112: ...context: EventContext
[app-scripts] L113: ) => any
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L359: listener: (payload?: T[K]) => any,
[app-scripts] L360: ...context: EventContext
[app-scripts] L361: ): this;
[app-scripts] A rest parameter must be of an array type.
[app-scripts] L365: listener: (payload?: T[K]) => any,
[app-scripts] L366: ...context: EventContext
[app-scripts] L367: ): this;