Commit 534203b4 authored by greg@1m's avatar greg@1m
Browse files

wip on doc generation based on typedoc json

parent 9d5f882b
This diff is collapsed.
......@@ -16,43 +16,6 @@ import { iSearchApi, useSearchApi } from './search.hook.api';
import { iStatusApi } from './status.api.hook';
import { iUploadApi, useUploadApi } from './upload.api.hook';
import { getFunctionParamNames } from '../../managers/functions.manager';
import { z } from "zod";
const User = z.object({
username: z.string()
});
export type iUser = z.infer<typeof User>
const myFunction = z
.function()
.args(z.string(), z.number()) // accepts an arbitrary number of arguments
.returns(z.boolean());
//@ts-ignore
window.myfun = myFunction
type myFunction = z.infer<typeof myFunction>;
// console.log(122222333, User, myFunction, JSON.stringify(myFunction.returnType()), myFunction.returnType()._def.typeName);
// en gros je peux creer des types et objets
// en deduire des types
// et je peux generer une docuentation
const nestedObj = z.object({
prop1: z.number(),
prop2: z.string(),
})
const myBiggerObject = z.object({
user: z.string(),
age: z.number().optional(),
fun: myFunction,
nested: nestedObj
})
//@ts-ignore
window.test2 = myBiggerObject
// console.log(122222333, z.(myBiggerObject));
// console.log(122222333, typeof myBiggerObject, JSON.stringify(myBiggerObject));
......
import React, { useEffect, useRef, useState } from 'react';
import { Popup } from '../../components/Popup.component';
import z, { Function, obj, fn, string, number, boolean } from "../../managers/types.manager";
import { strings } from '../../managers/strings.manager';
const liveVars: {
onAccept: Function,
......@@ -10,42 +11,15 @@ const liveVars: {
onRefuse: () => { },
}
// INTERFACES
const zPrompt = z.function()
.args(z.object({
text: string,
title: string.optional(),
onAccept: fn.optional(),
onRefuse: fn.optional()
}))
.returns(z.void())
const zConfirmPopup = z.function().args(z.string({ description: "woop" }), z.number({ description: "wooop2" })).returns(z.void())
// const test = z.function().args(z.string().describe("woo"))
const test = z.function().args(z.string({}))
type iTest = z.infer<typeof test>
type iPrompt = z.infer<typeof zPrompt>
type iConfirm = z.infer<typeof zConfirmPopup>
export type iPrompt = (p: {
text: string,
title?: string,
onAccept?: Function,
onRefuse?: Function
}) => void
export type iConfirmPopup = (text: string, cb: Function) => void
export type iPopupApi = { confirm: iConfirmPopup, prompt: iPrompt }
// old
// export type iPrompt = (p: {
// text: string,
// title?: string,
// onAccept?: Function,
// onRefuse?: Function
// }) => void
export const PopupContext = React.createContext<iPopupApi | null>(null);
export const usePromptPopup = (p: {
}) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment