Flowing
Dev
更多工具
添加到项目
项目模式
搜索工具和命令…
⌘ K
简体中文
TypeScript Playground
免费
在浏览器中立即运行 TypeScript:类型会被即时剥离,输出内容会显示在控制台。 你的代码在浏览器里独立的沙盒中运行,绝不会被上传。
基础知识
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
interface User { name: string; age: number } const users: User[] = [ { name: "Ada", age: 36 }, { name: "Linus", age: 28 }, ]; function oldest(list: User[]): User | undefined { return [...list].sort((a, b) => b.age - a.age)[0]; } console.log("Oldest:", oldest(users)?.name); document.body.innerHTML = `<h1>${users.length} users</h1>`;
运行
边写边自动运行
运行时: Sucrase
控制台
控制台输出会显示在这里。