mirror of
https://github.com/ritz078/transform.git
synced 2026-11-26 02:33:50 +03:00
24 lines
605 B
TypeScript
24 lines
605 B
TypeScript
import ConversionPanel from "@components/ConversionPanel";
|
|
import * as React from "react";
|
|
import { useCallback } from "react";
|
|
import { compile } from "json-schema-to-typescript";
|
|
|
|
export default function() {
|
|
const transformer = useCallback(async ({ value }) => {
|
|
return compile(JSON.parse(value), "MySchema", {
|
|
bannerComment: ""
|
|
});
|
|
}, []);
|
|
|
|
return (
|
|
<ConversionPanel
|
|
transformer={transformer}
|
|
editorTitle="JSON Schema"
|
|
editorLanguage="json"
|
|
editorDefaultValue="jsonSchema"
|
|
resultTitle="TypeScript"
|
|
resultLanguage={"typescript"}
|
|
/>
|
|
);
|
|
}
|