Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide types for exposed components #41

Open
miguelgrc opened this issue May 23, 2024 · 7 comments
Open

Provide types for exposed components #41

miguelgrc opened this issue May 23, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@miguelgrc
Copy link
Collaborator

Define types for the components exposed in index.ts for safety and better integration with linters.

@miguelgrc miguelgrc added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 23, 2024
@Sky-De
Copy link

Sky-De commented May 23, 2024

@miguelgrc hi there, please assign this to me, i would like to fix this, thanks

@miguelgrc
Copy link
Collaborator Author

Thanks for your interest @Sky-De! I have assigned it to you. FYI, related to this, we are about to merge this PR where we are adding some types for the new code editor fields. Let me know if you have any question.

@Sky-De
Copy link

Sky-De commented May 24, 2024

@miguelgrc Thanks for the assignment, to prevent any conflict and extra work to resolve those conflicts, I will wait till you merge all pending PRs then I will fork this repository and fix this issue, I will check it again, but I would be grateful if you inform me when you merged PR that you have mentioned in last comment, thanks, sky-de

@miguelgrc
Copy link
Collaborator Author

@Sky-De we've merged #43 :)

@Sky-De
Copy link

Sky-De commented May 27, 2024

@miguelgrc thanks for informing me, I will start adding types to
1.PropertyEditor
2.SelectFieldType
3.SchemaPreview
4.FormPreview
5.SelectOrEdit
components as clean as possible, but these days I'm a little busy, every day I will work on one of them, and after they are all done I will create PR

@Sky-De
Copy link

Sky-De commented May 28, 2024

@miguelgrc Hey again, I need your help, if you don't mind. First of all, I encountered this warning which prevents the app from loading:
Screenshot 2024-05-28 043158

then can you please clarify store/schrmaWizard types
const initialState = {
current: {
schema: {},
uiSchema: {},
},
initial: {
schema: {},
uiSchema: {},
},
initialConfig: {},
config: {},
field: {},
formData: {},
propKeyEditor: null,
error: null,
loader: false,
version: null,
};

you have used { } empty objects instead of the initial value inside those objects which makes it hard to understand what exactly those types should be

also const path = useSelector((state) => state.schemaWizard.field.path); schemaWizard is not part of state, what is that ?
and last question does this app work?

@miguelgrc
Copy link
Collaborator Author

miguelgrc commented May 28, 2024

Hi @Sky-De, replying to your questions:

  1. Are you trying to run formule or formule-demo? You should run the latter for development, check its readme.

  2. That's actually part of the task, we need to restrict those types and for that we need to first figure out what those types should be. schema and uiSchema will be jsonschemas, whose initial value will be {} (although they're initialized by initSchemaStructure on new schema creation). initialConfig and config are fields we use in CAP to pass various configuration variables, they are something we might want to rethink eventually so for now just treat is as any arbitrary object. field can contain path and uiPath inside, which are arrays of strings. formData is a concept from RJSF (see here) and contains the values of the fields, so pretty hard to type, just assume it's an arbitrary object again. propKeyEditor and error are currently unused, you should simply delete them. version would be an optional string.

  3. That's the correct way to access the redux store. See the docs

  4. Yes, it works and it's being used in CAP, but as I said in 1. you need to run formule-demo, which is a simple app that imports the formule library. The library itself can't be run as it's just that, a library, and not a standalone app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants