first i use fill function
const range = new Array(layernum.length).fill(NaN);//[ts] Property 'fill' does not exist on type 'any[]'
to deal with this problem,i use
const range = new Int32Array(layernum.length).fill(NaN);
instead
while,it cause another problem
let layer = range.map(e => range.map(e => e)); //Type 'Int32Array' is not assignable to type 'number'
so how to use prototype in Typescript