|
3 | 3 | */
|
4 | 4 | import { assert } from '@ember/debug';
|
5 | 5 |
|
6 |
| -import type Model from '@ember-data/model'; |
7 | 6 | import { SkipCache } from '@ember-data/request';
|
8 | 7 | import type { ImmutableRequestInfo } from '@ember-data/request/-private/types';
|
9 | 8 | import { constructResource, ensureStringId } from '@ember-data/store/-private';
|
10 | 9 | import type { ResourceIdentifierObject } from '@ember-data/types/q/ember-data-json-api';
|
| 10 | + |
11 | 11 | import { isMaybeIdentifier, normalizeModelName } from './utils';
|
12 | 12 |
|
13 |
| -// Keeping unused generics for consistency with 5x types |
14 |
| -type FindRecordRequestInput<T extends string = string, RT = unknown> = ImmutableRequestInfo & { |
| 13 | +type FindRecordRequestInput = ImmutableRequestInfo & { |
15 | 14 | op: 'findRecord';
|
16 | 15 | data: {
|
17 | 16 | record: ResourceIdentifierObject;
|
@@ -63,20 +62,20 @@ type FindRecordBuilderOptions = {
|
63 | 62 | @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.
|
64 | 63 | @return {FindRecordRequestInput} request config
|
65 | 64 | */
|
66 |
| -export function findRecordBuilder<T extends Model>( |
| 65 | +export function findRecordBuilder( |
67 | 66 | resource: string,
|
68 | 67 | id: string,
|
69 | 68 | options?: FindRecordBuilderOptions
|
70 |
| -): FindRecordRequestInput<string, T>; |
| 69 | +): FindRecordRequestInput; |
71 | 70 | export function findRecordBuilder(
|
72 | 71 | resource: string,
|
73 | 72 | id: string,
|
74 | 73 | options?: FindRecordBuilderOptions
|
75 | 74 | ): FindRecordRequestInput;
|
76 |
| -export function findRecordBuilder<T extends Model>( |
| 75 | +export function findRecordBuilder( |
77 | 76 | resource: ResourceIdentifierObject,
|
78 | 77 | options?: FindRecordBuilderOptions
|
79 |
| -): FindRecordRequestInput<string, T>; |
| 78 | +): FindRecordRequestInput; |
80 | 79 | export function findRecordBuilder(
|
81 | 80 | resource: ResourceIdentifierObject,
|
82 | 81 | options?: FindRecordBuilderOptions
|
@@ -104,7 +103,7 @@ export function findRecordBuilder(
|
104 | 103 |
|
105 | 104 | options = options || {};
|
106 | 105 |
|
107 |
| - assert('findRecord builder does not support options.preload', !(options as any).preload); |
| 106 | + assert('findRecord builder does not support options.preload', !(options as { preload?: boolean }).preload); |
108 | 107 |
|
109 | 108 | return {
|
110 | 109 | op: 'findRecord' as const,
|
|
0 commit comments