Skip to content

Commit

Permalink
Merge pull request #46 from innocenzi/feat/optional
Browse files Browse the repository at this point in the history
feat: support `nullToOptional`
  • Loading branch information
rubenvanassche authored Oct 4, 2024
2 parents 5c90e4d + bfef506 commit 723cc0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/typescript-transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'auto_discover_types' => [
app_path()
app_path(),
],

/*
Expand Down Expand Up @@ -75,4 +75,12 @@
*/

'transform_to_native_enums' => false,

/*
* By default, this package will convert PHP nullable properties to TypeScript
* types using a `null` type union. Setting `transform_null_to_optional` will
* make them optional instead.
*/

'transform_null_to_optional' => false,
];
1 change: 1 addition & 0 deletions src/TypeScriptTransformerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function packageRegistered(): void
->writer(config('typescript-transformer.writer', TypeDefinitionWriter::class))
->formatter(config('typescript-transformer.formatter'))
->transformToNativeEnums(config('typescript-transformer.transform_to_native_enums', false))
->nullToOptional(config('typescript-transformer.transform_null_to_optional', false))
);
}
}

0 comments on commit 723cc0e

Please sign in to comment.