const a:never[]=[]
const b:string[] = a // never[] CAN assign to string[]
const c=(d:never)=>{}
c(1) // number cant assign to never
const d =(e:string[])=>{}
d(a) // never[] CAN assign to string[]
const e = (f:never[])=>{}
e(b) // string[] cant assign to never[]
const f:never = 1 as never
const g:string = f // never CAN assign to string
console.log(g.toLowerCase()) // runtime error!!
能够将never
分配给其他类型的打字稿理由是什么?
可能会导致运行时错误,如代码的最后一行所示