Skip to content

const命令声明的变量,自动推断不是值类型 #128

Closed
@seolwinlong

Description

@seolwinlong

第四章类型系统,#5 值类型 中“TypeScript 推断类型时,遇到const命令声明的变量,如果代码里面没有注明类型,就会推断该变量是值类型。”
实际测试中未定义类型的变量,通过自动推导会推断成基本类型。

Image

Activity

ruanyf

ruanyf commented on May 12, 2025

@ruanyf
Contributor

原文正确

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ruanyf@seolwinlong

        Issue actions

          const命令声明的变量,自动推断不是值类型 · Issue #128 · wangdoc/typescript-tutorial