Comments (5)
We're migrating to a new way to define models to reduce the TypeScript boilerplate, this includes a new mechanism that determines whether the attribute is optional when creating a new instance.
It considers all nullable properties as being optional, because not specifying them will default to null
It does that by checking whether null can be assigned to the type (null extends T
).
I suppose that because when strictNullChecks
is false every type will accept null
, then every attribute will be considered optional
from website.
It's done inside Model so InferCreationAttributes
wouldn't impact that
strictNullChecks
is not required but these errors will only be caught by typescript if it's on. I'll add a note in the documentation about that
from website.
I'm moving this issue to our new documentation website repository to keep better track of it
from website.
Update:
It appears to be calculating the required parameters correctly when strictNullChecks: true
is configured in compilerOptions
in tsconfig.json
Additionally, the parameters are being correctly calculated in [email protected]
without strictNullChecks: true
from website.
Right, I tried it with InferCreationAttributes
and ran into the same problem. Will strictNullChecks: true
be required in the future?
For projects with strictNullChecks
disabled it could require some significant refactoring to enable it. Which they should do anyways to be honest.
If strictNullChecks
will be required, It'd be a good idea to leave a note about that in the documentation if it's not already
from website.
Related Issues (20)
- footgun/regression: Creating a new model with a JSONB column set to null inserts a JSONB `null` value rather than leaving the column as `null` HOT 4
- Foreign key by default is null
- SubQuery parameter is not documented or is not easy to find HOT 1
- Information about dynamic configuration files and .sequelizerc are badly located on website.
- Broken example code on Raw SQL page HOT 4
- Optimistic locking example is missing from the model configuration docs [v6]
- documentation of codes should include their respective file names
- Sequelize doesn't treat date string as UTC HOT 3
- addProfile is not function on many to many relationship HOT 1
- Documentation for nuxt 3
- Slack link on web site is expired HOT 1
- Optional doesn't exist in Sequelize 7, but mentioned in documentation HOT 3
- Add redshift instructions to your getting started guide HOT 1
- V7-alpha connectionManager.initPools missing HOT 1
- unable to access sequelize.org with ipv4 HOT 1
- Typo in kysely-sequelize URL HOT 1
- Model Associations in the ES6 Class Way
- Sequelize sourceKey Option Not Recognizing Custom Column Names in Associations
- Mysql JSON issue
- Damarcus Jones Ai Chips
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from website.