Skip to content

Commit

Permalink
Merge pull request #22 from kiwilan/develop
Browse files Browse the repository at this point in the history
1.11.01
  • Loading branch information
ewilan-riviere authored Aug 9, 2023
2 parents e92902f + 4ad50f9 commit 17d6cc1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"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"
Expand Down
2 changes: 1 addition & 1 deletion lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "ESNext",
"module": "ES2020",
"target": "ESNext",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion lib/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions src/Typed/Eloquent/Utils/EloquentRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
) {
}

Expand Down Expand Up @@ -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;
}
}
10 changes: 10 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 17d6cc1

Please sign in to comment.