Skip to content

Conversation

@Maxi10022
Copy link

Summary:

Added TypeScript support - see issue #92.
Samples on JavaScript usage and TypeScript usage have also been added, using the TypeScript based package (from file).
Note docs might still need updates documenting the newly added TypeScript types, didn't have anymore time to do this.

Completed Tasks:

  1. Convert existing files to TypeScript:
  • Rename .jsx or .js files to .tsx or .ts as appropriate.
  • Add type annotations for all component props, state, and internal variables.
  1. Define and export types for component props and state:
  • Define interfaces for complex props, options, and states.
  • Add type declarations for any event handlers or callback functions used in props.
  1. Update project configurations:
  • Add a tsconfig.json file with the necessary compiler options.
  • Update build scripts (if needed) to support TypeScript.
  1. Test compatibility with JavaScript projects:
  • Ensure that JavaScript users can still import and use the component without any issues.
  • Confirm that JavaScript users are not forced into type constraints.
  1. Documentation Update:
  • Update the README or other documentation to reflect the addition of TypeScript support.
  • Provide examples for both JavaScript and TypeScript users, demonstrating how to import and use the component.

@Saifullah-dev let me know if there's are any changes or fixes needed.

Renamed all `.js` and `.jsx` files to `.ts` and `.tsx` respectively.
Added tsconfig.json.
Started defining common types and functions, located in "/src/types".
Added type annotations to all contexts.
Now fully implemented this context, forgot adding that in previos commit.
Does not seem to be working with TypeScript, removed for now.
Added correct type annotations
Added type annotations.
Defined `TranslationFunction` which allows for passing parameters to `i18n`.
Fixed import of the `OnFolderChange` type
Added guard clauses to throw when `undefined` on `use[Context]` calls.
This allows to continue using hooks like this:
```
const { files } = useFiles();
```
Added `OnRefresh` type
Added type annotations
Configured lib to be `ESNect`
Now uses the `TriggerAction` and `TriggerActionType` defined in a seperate file
Added property types for each component.
Added type annotations and defined return type (`AxiosResponse`) where needed.
Was not yet fully configured ported to TypeScript
Made some parameters nullable.
The list of files copied to the clipboard are no longer nullable.
Added parameter `[key: string]: any` to `File` for JS-compatability, e.g. people setting an id in JS, not defined in the TypeScript type.
Added `FileExtended` type for internal usage.
Allows for the `import.meta.env` to be recognized
Defined response type.
Added `previewFile` to defined trigger action types.
Reanmed all usages of custom `File` type to `IFile`, now allows the
`OnFileUploading` type to take in the actual nodejs file.
Both now use the `FileExtended` type
@Saifullah-dev
Copy link
Owner

@Maxi10022 Thanks for this contribution 🙌, looks good :)
I'll do a detailed review and hopefully release this by tomorrow.

@Maxi10022
Copy link
Author

@Saifullah-dev let me know if any changes or fixes are needed

@Saifullah-dev
Copy link
Owner

@Maxi10022 Sorry for the delay. I was quite busy past few days. I'll hopefully review and merge this over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants