TS 骨架代码
TypeScript / React 高频骨架代码行,配合代码模式练习(大小写敏感)
词条计数说明
本页展示前 50 词 / 完整 50 词。该词库全部 50 条已完整列出。
术语对照与用法说明
下面按用途归类的 TypeScript 词汇,全部来自本页词库;其中若干条也是前端英语词汇里高频出现的行,词形与释义与下方完整词条列表逐条一致。
这份词库同样以整行代码为词条,但换成了 TypeScript / React 的高频写法:`const [count, setCount] = useState(0);`、`await Promise.all([...])`、`const safe = user?.profile?.avatarUrl;`。它的用途与 Go 词库一致——在代码模式下做大小写敏感的整行敲击,同时因为这些都是前端日常会读到的行,也适合当作前端英语词汇的熟悉度材料。下面按用途分组。
下面 7 个场景分组覆盖本页全部 50 个词条, 分组依据是词条本身的用途(代码型词库按每行代码的职责归类,术语型词库按词形归类),不是人工随意编排。
React Hooks6 词
useState / useEffect / useRef / useMemo / useParams——组件状态与副作用主干。
- const [state, setState] = useState(initialState);
- const [count, setCount] = useState(0);
- useEffect(() => { load(); }, []);
- const ref = useRef<HTMLInputElement>(null);
- const memo = useMemo(() => build(x), [dep]);
- const params = useParams<{ id: string }>();
数组与集合操作10 词
map / filter / reduce / find / some / every / Set 去重与遍历。
- const total = nums.reduce((a, b) => a + b, 0);
- const active = items.filter((x) => x.ok);
- const names = users.map((u) => u.name);
- const found = list.find((x) => x.id === id);
- const uniq = [...new Set(rawList)];
- const sorted = [...list].sort((a, b) => a - b);
- const has = list.some((x) => x.done);
- const allOk = rows.every((r) => r.valid);
- for (const item of list) render(item);
- Object.keys(config).forEach(apply);
类型定义与模块导出7 词
interface、联合类型、泛型与 as 断言,以及默认导出与具名导出。
- interface User { id: number; name: string }
- type Status = 'idle' | 'loading' | 'done';
- export default function App() {
- function sum(...nums: number[]): number {
- type Handler<T> = (event: T) => void;
- const data = JSON.parse(rawText) as Row[];
- export const API = 'https://api.dev/v1';
浏览器与 DOM6 词
window / document 事件、localStorage、元素尺寸读取,以及事件对象类型标注与阻止冒泡。
- window.addEventListener('resize', onResize);
- localStorage.setItem('key', value);
- const width = el?.getBoundingClientRect().width;
- el.addEventListener('click', onClick);
- document.title = 'Geek Typing';
- const stop = (e: Event) => e.stopPropagation();
异步请求与空值处理8 词
async / await、Promise.all 并发与 fetch 取JSON,以及请求链上配套的抛错、空值合并、三元表达式与可选链。
- if (!user) throw new Error('no user');
- const value = input ?? 'fallback';
- const label = isOpen ? 'open' : 'closed';
- await Promise.all([fetchA(), fetchB()]);
- const load = async (id: string) => {};
- const json = await res.json();
- const req = await fetch('/api/words');
- const safe = user?.profile?.avatarUrl;
模板字符串、展开与 JSX7 词
模板字符串插值、对象展开、数组与对象解构,以及 JSX、className、条件渲染与内联样式对象。
- const key = `${prefix}-${index}`;
- const merged = { ...base, ...overrides };
- const [head, ...tail] = sortedList;
- const { id, name, email } = profile;
- return <div className="app">{children}</div>;
- const shown = collapsed ? null : <List />;
- const style = { color: 'red', margin: 0 };
运行时与浏览器 API6 词
定时器、深拷贝、JSON 解析、Node 环境变量与随机 ID。
- const timer = setInterval(tick, 1000);
- clearTimeout(timerRef.current);
- const copy = structuredClone(original);
- const upper = str.trim().toUpperCase();
- const isDev = process.env.NODE_ENV !== 'prod';
- const id = crypto.randomUUID();
相关词库
这几个词库在真实工作里常一起出现,可以连着练: 后端服务与运维、推理任务与集群、前端框架与工程化词各成一条线。
词汇列表
- const [state, setState] = useState(initialState);
- const [count, setCount] = useState(0);
- useEffect(() => { load(); }, []);
- interface User { id: number; name: string }
- type Status = 'idle' | 'loading' | 'done';
- const total = nums.reduce((a, b) => a + b, 0);
- const active = items.filter((x) => x.ok);
- const names = users.map((u) => u.name);
- const found = list.find((x) => x.id === id);
- if (!user) throw new Error('no user');
- const value = input ?? 'fallback';
- const label = isOpen ? 'open' : 'closed';
- const key = `${prefix}-${index}`;
- await Promise.all([fetchA(), fetchB()]);
- const load = async (id: string) => {};
- export default function App() {
- function sum(...nums: number[]): number {
- const merged = { ...base, ...overrides };
- const [head, ...tail] = sortedList;
- type Handler<T> = (event: T) => void;
- const ref = useRef<HTMLInputElement>(null);
- const memo = useMemo(() => build(x), [dep]);
- window.addEventListener('resize', onResize);
- const timer = setInterval(tick, 1000);
- clearTimeout(timerRef.current);
- const data = JSON.parse(rawText) as Row[];
- const json = await res.json();
- const req = await fetch('/api/words');
- localStorage.setItem('key', value);
- const copy = structuredClone(original);
- const uniq = [...new Set(rawList)];
- const sorted = [...list].sort((a, b) => a - b);
- const has = list.some((x) => x.done);
- const allOk = rows.every((r) => r.valid);
- const { id, name, email } = profile;
- const safe = user?.profile?.avatarUrl;
- const upper = str.trim().toUpperCase();
- const width = el?.getBoundingClientRect().width;
- el.addEventListener('click', onClick);
- for (const item of list) render(item);
- Object.keys(config).forEach(apply);
- export const API = 'https://api.dev/v1';
- const isDev = process.env.NODE_ENV !== 'prod';
- document.title = 'Geek Typing';
- return <div className="app">{children}</div>;
- const shown = collapsed ? null : <List />;
- const params = useParams<{ id: string }>();
- const id = crypto.randomUUID();
- const style = { color: 'red', margin: 0 };
- const stop = (e: Event) => e.stopPropagation();
使用说明
以上词条与释义直接来自本词库的内容包(ts-code),未做改写。 本页是静态索引页,只列出词条与释义,不提供练习;完整词库、打字练习与复习调度请进入应用。
进入完整词库 →