---
title: "Discussion on \"对表单值进行 TypeScript 类型推断\" | Hashnode"
description: "Discussion on \"对表单值进行 TypeScript 类型推断\". 解释\n简单来说就是，你通过表单描述去定义了表单的属性，然后你现在要做一个表单值对象，这个对象的属性名、值类型都得是描述里面出现过的。\n// config\n[\n  {\n    name: 'link',\n    type: 'string',\n  },\n  {\n    name: 'age',\n    type: 'number',\n  }\n]\n\n// 合法的 value\n{\n  link: '',\n  age: 0,\n}\n\n// 不合法的 value\n{\n  link: 666,\n  age: ..."
url: "https://hashnode.com/posts/ts/6739f6368f50ccda111b09da"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [对表单值进行 TypeScript 类型推断](https://erio.hashnode.dev/ts?utm_source=hashnode&utm_medium=feed)

解释 简单来说就是，你通过表单描述去定义了表单的属性，然后你现在要做一个表单值对象，这个对象的属性名、值类型都得是描述里面出现过的。 // config \[ { name: 'link', type: 'string', }, { name: 'age', type: 'number', } \] // 合法的 value { link: '', age: 0, } // 不合法的 value { link: 666, age: ...

Nov 17, 2024 · 2 min read · erio.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#type-generics](https://hashnode.com/tag/type-generics)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Erioifpud](https://hashnode.com/@Erioifpud)

@Erioifpud

  
[View profile](https://hashnode.com/@Erioifpud)

Development

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
