我被打字稿中的类型错误困住了:
这是示例代码:
type myFunctionType<T, U> = (t: T, u: U) => U;
const testRoutine = <T, U>(myFn: (t: T, u: U) => U) => { };
const testRoutine2 = <T, U>(myFn: myFunctionType) => { };
我从testRoutine2上的打字稿编译器收到以下错误
error TS2314: Generic type 'myFunctionType' requires 2 type argument(s).
testRoutine看起来与testRoutine2完全一样,那么为什么编译器会出错? 有人可以帮忙吗? 谢谢
答案 0 :(得分:2)
以这种方式尝试
ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: insert or update on table "audits" violates foreign key constraint "fk_rails_cdcc9ea3cc"
DETAIL: Key (song_id)=(305) is not present in table "songs".