mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@types/redux-orm] correct throughFields property on many() object parameter (#37326)
fixes #37293
This commit is contained in:
parent
db59d133e5
commit
a24d647874
12
types/redux-orm/fields.d.ts
vendored
12
types/redux-orm/fields.d.ts
vendored
@ -8,6 +8,7 @@ export interface AttributeOpts {
|
||||
|
||||
export class Attribute extends Field {
|
||||
constructor(opts?: AttributeOpts);
|
||||
['type']: 'attr';
|
||||
}
|
||||
|
||||
export interface AttributeWithDefault extends Attribute {
|
||||
@ -18,10 +19,7 @@ export interface RelationalFieldOpts {
|
||||
to: string;
|
||||
relatedName?: string;
|
||||
through?: string;
|
||||
throughFields?: {
|
||||
to: string;
|
||||
from: string;
|
||||
};
|
||||
throughFields?: [string, string];
|
||||
as?: string;
|
||||
}
|
||||
|
||||
@ -30,14 +28,18 @@ export class RelationalField extends Field {
|
||||
constructor(opts: RelationalFieldOpts);
|
||||
}
|
||||
|
||||
export class OneToOne extends RelationalField {}
|
||||
export class OneToOne extends RelationalField {
|
||||
['type']: 'oneToOne';
|
||||
}
|
||||
|
||||
export class ForeignKey extends RelationalField {
|
||||
readonly index: true;
|
||||
['type']: 'fk';
|
||||
}
|
||||
|
||||
export class ManyToMany extends RelationalField {
|
||||
readonly index: false;
|
||||
['type']: 'many';
|
||||
}
|
||||
|
||||
export interface AttrCreator {
|
||||
|
||||
@ -44,6 +44,7 @@ class Book extends Model<typeof Book, BookFields> {
|
||||
static options = {
|
||||
idAttribute: 'title' as const
|
||||
};
|
||||
|
||||
static reducer(action: RootAction, Book: ModelType<Book>) {
|
||||
switch (action.type) {
|
||||
case 'CREATE_BOOK':
|
||||
@ -380,11 +381,7 @@ const sessionFixture = () => {
|
||||
|
||||
type TestSelector = (state: RootState) => Ref<Book>;
|
||||
|
||||
const selector0 = createOrmSelector(
|
||||
orm,
|
||||
s => s.db,
|
||||
session => session.Book.first()!.ref
|
||||
) as TestSelector;
|
||||
const selector0 = createOrmSelector(orm, s => s.db, session => session.Book.first()!.ref) as TestSelector;
|
||||
|
||||
const selector1 = createOrmSelector(
|
||||
orm,
|
||||
@ -504,3 +501,6 @@ const sessionFixture = () => {
|
||||
Book.create({ title: 'foo', publisher: 'error' }); // $ExpectError
|
||||
Book.create({ title: 'foo', publisher, coverArt: 'bar', authors: [3, author] }); // $ExpectError
|
||||
})();
|
||||
|
||||
// redux-orm-types#18
|
||||
(() => many({ to: 'Bar', relatedName: 'foos', through: 'FooBar', throughFields: ['foo', 'bar'] }))();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user