File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @rbxts/proton" ,
3
- "version" : " 0.5.7 " ,
3
+ "version" : " 0.5.8 " ,
4
4
"description" : " Framework for Roblox game development" ,
5
5
"main" : " out/init.lua" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change
1
+ import { Proton , ProtonStart , Provider } from "./core" ;
2
+
1
3
type LifecycleCallback < T > = ( ...args : Parameters < T > ) => void ;
2
4
3
5
/**
@@ -143,13 +145,16 @@ export class ProtonLifecycle<T extends LifecycleCallback<T>> {
143
145
*/
144
146
export function Lifecycle < T extends LifecycleCallback < T > > ( lifecycle : ProtonLifecycle < T > ) {
145
147
return (
146
- target : InferThis < ( this : defined , ... args : Parameters < T > ) => void > ,
148
+ target : defined ,
147
149
property : string ,
148
150
descriptor : TypedPropertyDescriptor < ( this : defined , ...args : Parameters < T > ) => void > ,
149
151
) => {
152
+ if ( Proton . get ( target as new ( ) => never ) === undefined ) {
153
+ error ( "[Proton]: Lifecycles can only be attached to providers" , 2 ) ;
154
+ }
150
155
lifecycle . register (
151
156
( ( ...args : Parameters < T > ) => {
152
- descriptor . value ( target , ...args ) ;
157
+ descriptor . value ( Proton . get ( target as new ( ) => never ) , ...args ) ;
153
158
} ) as T ,
154
159
tostring ( target ) ,
155
160
) ;
You can’t perform that action at this time.
0 commit comments