# 03 · typed-events **演示**:自定义元素派发 `CustomEvent`;监听器里收窄后读取 `detail.value`。 **运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开 `http://localhost:8080/examples/30-web-components-types/03-typed-events/`;开 Console。 **预期控制台输出**: ```text value:7 ``` **类型检查**:`node node_modules/typescript/bin/tsc -p examples/30-web-components-types/03-typed-events/tsconfig.types.json` **注意**:事件名是普通字符串,类型系统不会自动把 `'value-change'` 映射到 `ValueEvent`;需要在监听器里收窄。