Skip to content

Type inference broken with angular inject function + @ngrx/store #1222

Description

@mattlewis92

Minimal repro (that compiles with typescript 5.8)

import {inject} from '@angular/core';
import {Store} from '@ngrx/store';

const store: Store = inject(Store);

Output with tsgo:

store-generic-inference/index.ts:4:7 - error TS2322: Type 'Store<unknown>' is not assignable to type 'Store<object>'.
  Type 'unknown' is not assignable to type 'object'.

4 const store: Store = inject(Store);
        ~~~~~

Found 1 error in store-generic-inference/index.ts:4

Minimal repro can be run here: https://github.com/mattlewis92/ts-go-issues-repros

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Type CheckingRelated to type checking, grammar checkingType OrderingAn issue related to ordering of types

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions