Giter VIP home page Giter VIP logo

Comments (2)

rubenvanassche avatar rubenvanassche commented on August 16, 2024 1

Hi @iamrgroot,

The reason for closing this is, how do we know if a property can be null or if a property is nullable. In code, how do we make a distinction between these two constructs in PHP:

export type Department = {
    a: string|null;
    b?: string
;}

I think attributes might be a solution here. So if you create a PR that implements this feature I would certainly merge it!

from typescript-transformer.

iamrgroot avatar iamrgroot commented on August 16, 2024

@rubenvanassche what was the reason this was closed? I can't find a method to automatically convert a Data class with optional properties without using Lazy. I would like to convert the following object

class Test extends Data
{
    public function __construct(
        public string $description_1,
        public ?string $description_2,
        public ?string $description_3 = null,
    ) {
    }
}

to

export type Department = {
    description_1: string;
    description_2: string|null;
    description_3?: string|null;
}

Is this possible or do I need a custom solution for this?

from typescript-transformer.

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.