You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because there are many breaking changes an upgrade is not that easy. There are many edge cases this guide does not
4
+
cover. We accept PRs to improve this guide.
5
+
6
+
## Upgrading to v3
7
+
8
+
Version 3 is a complete rewrite of the package. That's why writing an upgrade guide is not that easy. The best way to
9
+
upgrade is to start reading the new docs and try to implement the new features.
10
+
11
+
A few noticeable changes are:
12
+
13
+
- Laravel installs now need to configure the package in a service provider instead of config file
14
+
- The package requires PHP 8.2
15
+
- If you're using Laravel, v10 is minimally required
16
+
- Collectors were removed in favour of Transformers which decide whether a type should be transformed or not
17
+
- The transformer should now return a `Transformed` object when it can transform a type
18
+
- The transformer interface now should return `Untransformable` when it cannot transform the type
19
+
- The `DtoTransformer` was removed in favour of a more flexible transformer system where you can create your own transformers
20
+
- The `EnumTransformer` was rewritten to allow multiple types of enums to be transformed and multiple output structures
21
+
- All other enum transformers were removed
22
+
- The concept of `TypeProcessors` was removed, `ClassPropertyProcessor` is a kinda replacement for this
23
+
- The TypeReflectors were removed
24
+
- Support for inline types was removed
25
+
- If you were implementing your own attributes, you should now implement the `TypeScriptTypeAttributeContract` interface instead of `TypeScriptTransformableAttribute`
26
+
- The `RecordTypeScriptType` attribute was removed since deduction of these kinds of types is now done by the transformer
27
+
- The `TypeScriptTransformer` attribute was removed
28
+
- If you were implementing your own `Formatter`, please update the `format` method to now work on an array of files
29
+
30
+
And so much more. Please read the docs for more information.
31
+
32
+
## Upgrading to v2
33
+
34
+
- The package is now PHP 8 only
35
+
- The `ClassPropertyProcessor` interface was renamed to `TypeProcessor` and now takes a union of reflection objects
36
+
- In the config:
37
+
-`searchingPath` was renamed to `autoDiscoverTypes`
38
+
-`classPropertyReplacements` was renamed to `defaultTypeReplacements`
39
+
- Collectors now only have one method: `getTransformedType` which should
40
+
- return `null` when the collector cannot find a transformer
41
+
- return a `TransformedType` from a suitable transformer
42
+
- Transformers now only have one method: `transform` which should
43
+
- return `null` when the transformer cannot transform the class
44
+
- return a `TransformedType` if it can transform the class
45
+
- In Writers the `replaceMissingSymbols` method was removed and a `replacesSymbolsWithFullyQualifiedIdentifiers` with `bool` as return type was added
46
+
- The DTO transformer was completely rewritten, please take a look at the docs how to create you own
47
+
- The step classes are now renamed to actions
48
+
49
+
Laravel
50
+
- In the Laravel config:
51
+
-`searching_path` is renamed to `auto_discover_types`
52
+
-`class_property_replacements` is renamed to `default_type_relacements`
53
+
-`writer` and `formatter` were added
54
+
- You should replace the `DefaultCollector::class` with the `DefaultCollector::class`
55
+
- It is not possible anymore to convert one file to TypeScript via command
0 commit comments