Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelDeMartin committed May 24, 2024
1 parent e20648b commit 4934395
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed

- Model collections are no longer inherited unless they were initialized explicitly.
- `Key` type is now typed as `string | number | Record<string, string | number>` instead of `any`. This was necessary to avoid values such as `null` or `undefined` accepted as valid keys.
- `ProxyEngine` is no longer an interface but a class that can be extended, you can still use `IProxyEngine` for backwards compatibility but it'll be removed in future versions.

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion src/engines/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type EngineAttributeFilter =
{ $contains: EngineAttributeFilter | EngineAttributeFilter[] };

export interface EngineRootFilter {
$in?: string[];
$in?: (string | number | Record<string, string | number>)[];
}

export type EngineAttributeUpdate =
Expand Down
2 changes: 1 addition & 1 deletion src/models/Model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ describe('Model types', () => {
Expect<Equals<Assert<User['contact']>['email'], string | undefined>> |
Expect<Extends<User['social'], undefined>> |
Expect<Equals<Assert<User['social']>['website'], string | undefined>> |
Expect<Equals<User['externalUrls'], Key[]>> |
Expect<Equals<User['externalUrls'], string[]>> |
Expect<Equals<User['createdAt'], Date>> |
Expect<Equals<Post['title'], string>> |
Expect<Equals<Pick<Post, 'title'>, { title: string }>> |
Expand Down
3 changes: 1 addition & 2 deletions src/models/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import type { TimestampFieldValue, TimestampsDefinition } from './timestamps';

const modelsWithMintedCollections = new WeakSet();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Key = string | number | object;
export type Key = string | number | Record<string, string | number>;
export type ModelListener<
TModel extends Model = Model,
TEvent extends keyof ModelEvents = keyof ModelEvents
Expand Down
2 changes: 1 addition & 1 deletion src/testing/stubs/User.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default defineModelSchema({
},
externalUrls: {
type: FieldType.Array,
items: FieldType.Key,
items: FieldType.String,
required: true,
},
},
Expand Down

0 comments on commit 4934395

Please sign in to comment.