Skip to content

Commit 75724b9

Browse files
authored
Update the type used in examples for optional creation attributes. (#724)
1 parent 0aa1b6c commit 75724b9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/models/model-typing.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ Example of a minimal TypeScript project with strict type-checking for attributes
8181
although it is much more verbose:
8282

8383
```typescript
84-
import { Model, Optional } from '@sequelize/core';
84+
import { Model } from '@sequelize/core';
85+
import type { PartialBy } from '@sequelize/utils';
8586

8687
type UserAttributes = {
8788
id: number,
@@ -90,7 +91,7 @@ type UserAttributes = {
9091

9192
// we're telling the Model that 'id' is optional
9293
// when creating an instance of the model (such as using Model.create()).
93-
type UserCreationAttributes = Optional<UserAttributes, 'id'>;
94+
type UserCreationAttributes = PartialBy<UserAttributes, 'id'>;
9495

9596
class User extends Model<UserAttributes, UserCreationAttributes> {
9697
@Attribute(DataTypes.INTEGER)

0 commit comments

Comments
 (0)