Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type for Snapshot.adapterOptions is unusable #1437

Open
1 task done
chriskrycho opened this issue Jun 23, 2021 · 2 comments
Open
1 task done

Type for Snapshot.adapterOptions is unusable #1437

chriskrycho opened this issue Jun 23, 2021 · 2 comments
Labels
types:core:data Something is wrong with the Ember Data type definitions types:core Something is wrong with the Ember type definitions

Comments

@chriskrycho
Copy link
Member

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.

@chriskrycho chriskrycho added the types:core Something is wrong with the Ember type definitions label Jun 23, 2021
@charlesfries
Copy link

Should the adapterOptions property on SnapshotRecordArray be typed the same way? Currently it is also of type {}

@charlesfries
Copy link

This should be fixed by DefinitelyTyped/DefinitelyTyped#60742

@chriskrycho chriskrycho added the types:core:data Something is wrong with the Ember Data type definitions label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types:core:data Something is wrong with the Ember Data type definitions types:core Something is wrong with the Ember type definitions
Projects
None yet
Development

No branches or pull requests

2 participants