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
In our SDK TypeScript code and in Wing code written in TypeScript, every API that accepts/returns Json is awkward to use because it basically requires as any.
For example:
import{cloud,lift,main}from"@wingcloud/framework";main((root,test)=>{constb=newcloud.Bucket(root,"Bucket");constfn=newcloud.Function(root,"Function",lift({ b }).grant({b: ["putJson"]}).inflight(async(ctx)=>{awaitctx.b.putJson("hello","world");// ^^^^^^^ Argument of type 'string' is not assignable to parameter of type 'Json'.ts(2345)returnundefined;}));});
Proposed Solution
Not ideal but at least it will keep things within the framework and not escape the type system: perhaps we can offer some utility methods on the Json type to make it easy to construct:
Use Case
In our SDK TypeScript code and in Wing code written in TypeScript, every API that accepts/returns
Json
is awkward to use because it basically requiresas any
.For example:
Proposed Solution
Not ideal but at least it will keep things within the framework and not escape the type system: perhaps we can offer some utility methods on the
Json
type to make it easy to construct:Implementation Notes
No response
Component
No response
Community Notes
The text was updated successfully, but these errors were encountered: