basarat / basarat/react-typescript

Confusing wording, "anything can be assigned to it and it can be assigned to anything" https://basarat.gitbook.io/typescript/type-system#special-types

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
62
Forks
26
PR merge metrics
No merged PRs in 30d

Description

On tutorial page https://basarat.gitbook.io/typescript/type-system#special-types

> The any type holds a special place in the TypeScript type system. It gives you an escape hatch from the type system to tell the compiler to bugger off. any is compatible with any and all types in the type system. This means that _**anything can be assigned to it and it can be assigned to anything**_....

if I take "it" to be the `any` type annotation then the phrase "anything can be assigned to it" doesn't make sense. we can't assign something to any keyword:

```
any = 5; // ❌ Invalid — 'any' is a keyword, not a variable

```

In programming we can't use ambiguous language. A better wording could have been:

> “anything can be assigned to a variable of type any, and a variable of type any can be assigned to anything.”

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.