Skip to content

[Bug] Properties of MutableArray "does not exist" on tracked array after importing from 'ember-source/types/preview' #20463

@johanrd

Description

@johanrd

🐞 Describe the Bug

Importing types from ember-source/types/preview breaks types of MutableArray properties on tracked arrays.

🔬 Minimal Reproduction

Clone this repo: https://github.com/johanrd/ember-typescript-reproducible-mutable-array

😕 Actual Behavior

Open app.ts, and see typescript error 2339 on line 18: this.list.pushObject(object):

Property 'pushObject' does not exist on type '{}[]'.ts(2339)

This also happens for other properties of MutableArray, e.g. firstObject, yet all other other type imports from ember-source works well, as far as I can see.

🤔 Expected Behavior

Types of MutableArray to be imported correctly – as they are from the "old" @types/ember__array package. Test that the 'old way' runs well in the same environment by simply removing the type imports on line 8:

-import 'ember-source/types/preview';

^ no errors after removing this line

🌍 Environment

  • Ember: 4.12.0 and 5.1.0-beta1

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

    Issue actions