Comments (2)
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.
@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)
- PHP enums still not transformed correctly HOT 2
- Use `undefined` instead of `null` by default HOT 4
- Using the transformer without artisan
- Make transform of Enums to types or to native enums configurable on class level (using an attribute) HOT 1
- There should be a "Transformer order matters!" warning in the docs HOT 1
- missing dependencies? HOT 2
- Broken link in the docs
- Generating Record-like types HOT 1
- i am using this packge but unable to transform the php class into typeScript HOT 1
- Feature request: Make namespace in ts file optional HOT 1
- Transformed 0 PHP types to TypeScript HOT 1
- Configure fallbackvalues other then any HOT 1
- [BUG] Unresolved array-key type HOT 1
- how to include specific private properties HOT 1
- Pick up the `DataCollectionOf` attribute from spatie/laravel-data HOT 1
- ArrayShapes HOT 2
- Update to PHP-Parser 5.0 HOT 1
- Backslashes are removed from enum values when using ::class notation.
- No default/clean install possible due to PHP-parser version conflict HOT 1
- v3, some expected date? HOT 1
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 typescript-transformer.