Skip to content

Type for Snapshot.adapterOptions is unusable #1437

Open
@chriskrycho

Description

@chriskrycho

Which package(s) does this problem pertain to?

  • @types/ember-data

What are instructions we can follow to reproduce the issue?

  • install latest types
  • try to use the Snapshot.adapterOptions as a record
  • Property '<whatever you try to access>' does not exist on type '{}'.

Reproduction Case

import DS from 'ember-data';

function useOptions(snapshot: DS.Snapshot) {
  let something = snapshot.adapterOptions.literallyAnything ?? {};
}

Now about that bug. What did you expect to see?

This should be typed as Record<string, unknown>.

What happened instead?

It's typed as {} and therefore goes 💥 when strict: true is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    types:coreSomething is wrong with the Ember type definitionstypes:core:dataSomething is wrong with the Ember Data type definitions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions