New 'unknown' top type by ahejlsberg · Pull Request #24439 · microsoft/TypeScript

added 17 commits

May 26, 2018 08:07

@ahejlsberg ahejlsberg changed the title New 'unknown New 'unknown' top type

May 27, 2018

weswigham

mhegazy

@bdsl bdsl mentioned this pull request

Jun 3, 2019

@orta orta mentioned this pull request

Oct 16, 2019

@darh darh mentioned this pull request

Feb 6, 2020

4 tasks

Gudahtt added a commit to MetaMask/core that referenced this pull request

Feb 25, 2021
The BaseController state now uses `unknown` rather than `any` as the
type for state properties. `unknown` is more type-safe than `any` in
cases like this where we don't know what type to expect. See here for
details [1].

This was suggested by @rekmarks during review of #362 [2].

[1]: microsoft/TypeScript#24439
[2]: #362 (comment)

Gudahtt added a commit to MetaMask/core that referenced this pull request

Feb 25, 2021
* Use `unknown` rather than `any` for BaseController state

The BaseController state now uses `unknown` rather than `any` as the
type for state properties. `unknown` is more type-safe than `any` in
cases like this where we don't know what type to expect. See here for
details [1].

This was suggested by @rekmarks during review of #362 [2].

[1]: microsoft/TypeScript#24439
[2]: #362 (comment)

* Use type alias for controller state rather than interface

The mock controller state in the base controller tests now uses a type
alias for the controller state rather than an interface. This was
required to get around an incompatibility between
`Record<string, unknown>` and interfaces[1].

The `@typescript-eslint/consistent-type-definitions` ESLint rule has
been disabled, as this problem will be encountered fairly frequently.

[1]: microsoft/TypeScript#15300 (comment)

This was referenced

Mar 10, 2023

MajorLift pushed a commit to MetaMask/core that referenced this pull request

Oct 11, 2023
* Use `unknown` rather than `any` for BaseController state

The BaseController state now uses `unknown` rather than `any` as the
type for state properties. `unknown` is more type-safe than `any` in
cases like this where we don't know what type to expect. See here for
details [1].

This was suggested by @rekmarks during review of #362 [2].

[1]: microsoft/TypeScript#24439
[2]: #362 (comment)

* Use type alias for controller state rather than interface

The mock controller state in the base controller tests now uses a type
alias for the controller state rather than an interface. This was
required to get around an incompatibility between
`Record<string, unknown>` and interfaces[1].

The `@typescript-eslint/consistent-type-definitions` ESLint rule has
been disabled, as this problem will be encountered fairly frequently.

[1]: microsoft/TypeScript#15300 (comment)

MajorLift pushed a commit to MetaMask/core that referenced this pull request

Oct 11, 2023
* Use `unknown` rather than `any` for BaseController state

The BaseController state now uses `unknown` rather than `any` as the
type for state properties. `unknown` is more type-safe than `any` in
cases like this where we don't know what type to expect. See here for
details [1].

This was suggested by @rekmarks during review of #362 [2].

[1]: microsoft/TypeScript#24439
[2]: #362 (comment)

* Use type alias for controller state rather than interface

The mock controller state in the base controller tests now uses a type
alias for the controller state rather than an interface. This was
required to get around an incompatibility between
`Record<string, unknown>` and interfaces[1].

The `@typescript-eslint/consistent-type-definitions` ESLint rule has
been disabled, as this problem will be encountered fairly frequently.

[1]: microsoft/TypeScript#15300 (comment)

@rotu rotu mentioned this pull request

Dec 31, 2023

@microsoft microsoft locked as resolved and limited conversation to collaborators

Oct 21, 2025