简体   繁体   中英

How do I enable Typescripts native List?

I read that Typescript now support List<> as native here

Is there a typescript List<> and/or Map<> class/library?

And that you can enable it with lib.d.ts but how? I found the file in the node_modules and I don't think I should edit that right? And even if I should edit it, what should I add/remove?

TypeScript does not add new runtime constructs to the language (with the notable exception of namespaces, which are pretty much deprecated, and enums).

Map is a JavaScript concept, therefore it is supported by TypeScript. List , however, is not.

There's no native implementation of List in TypeScript. Use an array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM