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
WIP. This isn't important to the proposal really. Just a place for me to jot down notes.
Server contract example.
@contract('contract')classContract{add(a:number,b:number):number{returna+b;}
@oneWayupdateProgress(
@validate(v=>v>=0&&v<=1)progress:number):void{/* do stuff */}simple(
@validate(v=>v.startsWith('a'))s:string):string{returns+t;}
@validate((a,b,c)=>b+c<10,'B + C must be less than 10')// Returned error. Others are silent.complex({(a:number),
@validate(v=>v<=10)(b:uint8)=0},[
@validateRange(1,10)c:uint8]):MyInterface{returnfoo(a,b,c);}foo(
@validate(a:number=>a<5)
@validate(a:string=>a=='a')a:number|string='a'):@validate(s=>s.length!=0)string{// return validationreturna.toString();}}
TODO: Add actually complex cases with union types and parameter decorators. Use interfaces and such to really iron out edge cases.
WIP. This isn't important to the proposal really. Just a place for me to jot down notes.
Server contract example.
TODO: Add actually complex cases with union types and parameter decorators. Use interfaces and such to really iron out edge cases.
Decorators would definitely need to be able to extract types.
TODO: Define decorators for above cases.
The text was updated successfully, but these errors were encountered: