Git Product home page Git Product logo

Comments (5)

ephys avatar ephys commented on August 27, 2024 1

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.

ephys avatar ephys commented on August 27, 2024 1

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.

ephys avatar ephys commented on August 27, 2024 1

I'm moving this issue to our new documentation website repository to keep better track of it

from website.

Seth10001 avatar Seth10001 commented on August 27, 2024

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.

Seth10001 avatar Seth10001 commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.