Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A code generator for Runtypes types. Perfect to create tooling to generate code for Runtypes!

License

NotificationsYou must be signed in to change notification settings

simenandre/generate-runtypes

Repository files navigation

Generate Runtypes types

A code generator for Runtypes types

lifecycleNPM versioncodecov

This library aims to provide an intuitive and easy way to generateRuntypes types. This package aims to be a great utility for aconversion package (e.g. JSON Schema to Runtypes).

We are thankful for all help with adding new functionality, fixing issues, orimprove the package. Feel free to open issues and pull requests ❤️

Documentation

Apart from this README, you can find details and examples of using the SDK inthe following places:

Example

import{generateRuntypes}from'generate-runtypes';constsourceCode=generateRuntypes([{name:'Comment',type:{kind:'record',fields:[{name:'author',type:{kind:'string'}},{name:'body',type:{kind:'string'}},{name:'timestamp',type:{kind:'number'}},],},},{name:'Post',export:true,type:{kind:'record',fields:[{name:'title',type:{kind:'string'}},{name:'body',type:{kind:'string'}},{name:'author',type:{kind:'string'}},{name:'comments',type:{kind:'array',type:{kind:'named',name:'Comment'}},},],},},]);

The generated code looks like this after formatting:

import*asrtfrom'runtypes';constComment=rt.Record({author:rt.String,body:rt.String,timestamp:rt.Number,});exportconstPost=rt.Record({title:rt.String,body:rt.String,author:rt.String,comments:rt.Array(Comment),});

About

A code generator for Runtypes types. Perfect to create tooling to generate code for Runtypes!

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp