[TypeScript ] What Happens to Compiled Interfaces
typescript to What
2023-09-14 09:00:53 时间
This lesson covers using your first TypeScript Interface and what happens to the Interface when it is compiled down to JavaScript.
Define the interfaces:
// interfaces.ts export interface Person { name: String } export interface SocialNetwork{ title: String; getPeople(): Person[]; }
Use interface:
import {SocialNetwork} from './interfaces'; class SocialNetworks implements SocialNetwork{ title = "Facebook"; getPeople(){ return [{name: 'John'}] } } new SocialNetworks();
To notice that, interfaces won't output to the js file, it is just used when compile time.
相关文章
- 基于 Vue3、TypeScript、Vite2、Pinia 开源的后台管理框架
- TypeScript(node)连接使用MySQL(JavaScript也一样)
- typescript 多继承_说明类的继承和多态有什么作用
- Create Your Own Redux (Typescript)
- 【说站】微软官方发布TypeScript 4.4版本
- 快速搭建基于Vue3+Vite2+Arco+Typescript+Pinia后台管理系统模板,文末有福利
- 一旦你学习了typescript,你就再也放不下了
- To add browser notifications to an online customer support live chat service system - gofly - self h
- 12个 Typescript 开发实用技巧清单
- TypeScript不学?你养我啊[2]
- (十四)与 TypeScript 集成
- 开心的档之TypeScript 变量声明
- 开心档之TypeScript 变量声明