主页
TypeScript
TypeScript 数组
demo_arrays_readonly
运行 ❯
×
更改方向
保存代码
更改主题
const names: readonly string[] = ["Dylan"]; names.push("Jack"); // Error: Property 'push' does not exist on type 'readonly string[]'. // try removing the readonly modifier and see if it works? console.log(names);
prog.ts(2,13): error TS2339: Property 'push' does not exist on type 'readonly string[]'.