diff --git a/composer.json b/composer.json index 044e54c..4b9aa22 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "kiwilan/typescriptable-laravel", "description": "PHP package for Laravel to type Eloquent models, routes, Spatie Settings with autogenerated TypeScript. If you want to use some helpers with Inertia, you can install associated NPM package.", - "version": "1.11.0", + "version": "1.11.01", "keywords": [ "kiwilan", "laravel", diff --git a/lib/package.json b/lib/package.json index ebf8321..b8bee64 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,11 +1,11 @@ { "name": "@kiwilan/typescriptable-laravel", "type": "module", - "version": "2.0.1", + "version": "2.0.4", "description": "Add some helpers for your Inertia app with TypeScript.", "author": "Ewilan Rivière ", "license": "MIT", - "homepage": "https://github.com/kiwilan/typescriptable-laravel/lib", + "homepage": "https://github.com/kiwilan/typescriptable-laravel/tree/main/lib", "repository": { "type": "git", "url": "git+https://github.com/kiwilan/typescriptable-laravel.git" diff --git a/lib/tsconfig.json b/lib/tsconfig.json index f260784..c1230fa 100644 --- a/lib/tsconfig.json +++ b/lib/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "ESNext", + "module": "ES2020", "target": "ESNext", "lib": ["ESNext", "DOM"], "esModuleInterop": true, diff --git a/lib/tsup.config.ts b/lib/tsup.config.ts index d1c61f5..f4d29c0 100644 --- a/lib/tsup.config.ts +++ b/lib/tsup.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ index: 'src/index.ts', }, format: ['cjs', 'esm'], - external: ['vue', '@inertiajs/vue3'], + external: ['vue', '@inertiajs/vue3', 'node:fs/promises', 'node:child_process'], outDir: 'dist', dts: true, minify: true, diff --git a/src/Typed/Eloquent/Utils/EloquentRelation.php b/src/Typed/Eloquent/Utils/EloquentRelation.php index b98eb5e..5a11def 100644 --- a/src/Typed/Eloquent/Utils/EloquentRelation.php +++ b/src/Typed/Eloquent/Utils/EloquentRelation.php @@ -12,8 +12,8 @@ public function __construct( public string $field, public bool $isArray = false, public bool $isMorph = false, - public ?string $type = null, - public ?string $typeTs = null, + public string $type = 'mixed', + public string $typeTs = 'any', ) { } @@ -69,6 +69,14 @@ private static function make(ReflectionMethod $method): self $relation->typeTs = 'any'; } + if (! $relation->type) { + $relation->type = 'mixed'; + } + + if (! $relation->typeTs) { + $relation->typeTs = 'any'; + } + return $relation; } } diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..d1345d3 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,10 @@ +# Test environment + +## SQL Server + +```bash +docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=12345OHdf%e" \ + -p 1433:1433 --name sqlserver --hostname sqlserver \ + -d \ + mcr.microsoft.com/mssql/server:2022-latest +```