不要怂,就是干,撸起袖子干!

Commit 6c76c240 by dy93 Committed by Simon Schick

docs(findbypk): fix document and type definition (#11005)

1 parent 30c5ca5e
...@@ -1856,7 +1856,7 @@ class Model { ...@@ -1856,7 +1856,7 @@ class Model {
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only) * @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* *
* @see * @see
* {@link Model.findAll} for a full explanation of options * {@link Model.findAll} for a full explanation of options, Note that options.where is not supported.
* *
* @returns {Promise<Model>} * @returns {Promise<Model>}
*/ */
......
...@@ -489,6 +489,8 @@ export interface IndexHintable { ...@@ -489,6 +489,8 @@ export interface IndexHintable {
indexHints?: IndexHint[]; indexHints?: IndexHint[];
} }
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
/** /**
* Options that are passed to any model creating a SELECT query * Options that are passed to any model creating a SELECT query
* *
...@@ -1756,12 +1758,12 @@ export abstract class Model<T = any, T2 = any> extends Hooks { ...@@ -1756,12 +1758,12 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
public static findByPk<M extends Model>( public static findByPk<M extends Model>(
this: { new (): M } & typeof Model, this: { new (): M } & typeof Model,
identifier?: Identifier, identifier?: Identifier,
options?: FindOptions options?: Omit<FindOptions, 'where'>
): Promise<M | null>; ): Promise<M | null>;
public static findByPk<M extends Model>( public static findByPk<M extends Model>(
this: { new (): M } & typeof Model, this: { new (): M } & typeof Model,
identifier: Identifier, identifier: Identifier,
options: NonNullFindOptions options: Omit<NonNullFindOptions, 'where'>
): Promise<M>; ): Promise<M>;
/** /**
......
...@@ -43,6 +43,7 @@ export interface SyncOptions extends Logging { ...@@ -43,6 +43,7 @@ export interface SyncOptions extends Logging {
/** /**
* If alter is true, each DAO will do ALTER TABLE ... CHANGE ... * If alter is true, each DAO will do ALTER TABLE ... CHANGE ...
* Alters tables to fit models. Not recommended for production use. Deletes data in columns that were removed or had their type changed in the model.
*/ */
alter?: boolean; alter?: boolean;
...@@ -66,11 +67,6 @@ export interface SyncOptions extends Logging { ...@@ -66,11 +67,6 @@ export interface SyncOptions extends Logging {
* If hooks is true then beforeSync, afterSync, beforeBulkSync, afterBulkSync hooks will be called * If hooks is true then beforeSync, afterSync, beforeBulkSync, afterBulkSync hooks will be called
*/ */
hooks?: boolean; hooks?: boolean;
/**
* Alters tables to fit models. Not recommended for production use. Deletes data in columns that were removed or had their type changed in the model.
*/
alter?: boolean;
} }
export interface DefaultSetOptions {} export interface DefaultSetOptions {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!