[TypeScript] AssertType

export function assertType<T>(obj: unknown = {}): T {
    return obj as T
}

const store = assertType<Store>({select: () => of()})

 

posted @ 2022-05-09 14:34  Zhentiw  阅读(38)  评论(0编辑  收藏  举报