@nolikein/types-livewire3 1.1.3 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +0 -0
- package/README.md +25 -3
- package/dist/Alpine.d.ts +0 -0
- package/dist/AlpineWired.d.ts +0 -0
- package/dist/Livewire.d.ts +0 -0
- package/dist/index.d.ts +0 -0
- package/package.json +2 -2
package/LICENCE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Allows you to use the power of TypeScript with Livewire 3.
|
|
4
4
|
|
|
5
|
+
## Migration From 1.x to 2.x
|
|
6
|
+
|
|
7
|
+
Now all your "LivewireMethods" interfaces should be a `Record<string, (...args: any) => any>` instead of `Record<string, any>`.
|
|
8
|
+
|
|
9
|
+
This means your code pass from:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
interface LivewireMethods {
|
|
13
|
+
open: ({ state: boolean })
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
interface LivewireMethods {
|
|
21
|
+
open: (state: boolean) => ({ state: boolean })
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
In order to keep the type safety of your methods parameters and return types.
|
|
26
|
+
|
|
5
27
|
## Installation
|
|
6
28
|
|
|
7
29
|
npm i -D @nolikein/types-livewire3
|
|
@@ -27,7 +49,7 @@ Now you are able to use Livewire and Alpine inside your project. Here is an exam
|
|
|
27
49
|
```ts
|
|
28
50
|
import { Livewire, Alpine } from '@/your_livewire_path';
|
|
29
51
|
|
|
30
|
-
Alpine.data('
|
|
52
|
+
Alpine.data('YourComponent', () => {});
|
|
31
53
|
Livewire.start();
|
|
32
54
|
```
|
|
33
55
|
|
|
@@ -62,7 +84,7 @@ interface LivewireData {
|
|
|
62
84
|
// Your Livewire public methods
|
|
63
85
|
interface LivewireMethods {
|
|
64
86
|
// The livewire component has an "open" method that you can call then return a boolean
|
|
65
|
-
open(): boolean
|
|
87
|
+
open(state: boolean): ({ state: boolean })
|
|
66
88
|
}
|
|
67
89
|
|
|
68
90
|
/**
|
|
@@ -80,7 +102,7 @@ export default (
|
|
|
80
102
|
},
|
|
81
103
|
|
|
82
104
|
callBackendToOpen(): void {
|
|
83
|
-
this.$wire.$call('open', (data
|
|
105
|
+
this.$wire.$call('open', true).then(data) => {
|
|
84
106
|
console.log("The livewire component has updated its open property with the value " + data.state);
|
|
85
107
|
});
|
|
86
108
|
},
|
package/dist/Alpine.d.ts
CHANGED
|
File without changes
|
package/dist/AlpineWired.d.ts
CHANGED
|
File without changes
|
package/dist/Livewire.d.ts
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolikein/types-livewire3",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Typescript content for Laravel Livewire 3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Côme Wasik",
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
"@types/alpinejs": "^3.13.11",
|
|
28
28
|
"typescript": "^5.9.2"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|