下面的代码在工作时出现了一个奇怪的错误,但是编译器给了我一个错误。
我相信两个地方的from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
runTouchApp(Builder.load_string(‘’’
<MyInputs@TextInput>:
focus: True
multiline: False
on_text_validate: self.get_focus_next().focus = True
BoxLayout:
MyInputs:
MyInputs:
MyInputs:
‘’’
中的C
都在扔
...args: C
代码如下:
: A rest parameter must be of an array type. (2370)
: A rest parameter must be of an array type. (2370)
: Type '<A extends string, B extends string, C extends any[], D>(A: A, B: B, fn: (...args: C) => D) => { ...' is not assignable to type 'MakeFromTo'.
Type '{ [x: string]: { to: { [x: string]: (...args: C) => D; }; }; }' is not assignable to type 'Record<A, { to: Record<B, (...args: C) => D>; }>'. (2322)
使用打字稿type MethodResult<TFrom extends string, TTo extends string, C extends any[], D> = Record<TFrom, {
to: Record<TTo, (...args: C) => D>;
}>;
type MakeFromTo = <A extends string, B extends string, C extends any[], D> (A: A, B: B, fn: (...args: C) => D) => MethodResult<A, B, C, D>;
const makeFromTo: MakeFromTo = (A, B, fn) => ({ [A]: { to: { [B]: fn } } });