Skip to content

Typescript webpack setup#1446

Closed
epicfaace wants to merge 7 commits intomasterfrom
typescript
Closed

Typescript webpack setup#1446
epicfaace wants to merge 7 commits intomasterfrom
typescript

Conversation

@epicfaace
Copy link
Member

@epicfaace epicfaace commented Sep 4, 2019

Reasons for making this change

For #583 and @thijssteel. Sets up webpack configuration needed to use typescript in the rjsf source. I've converted Form.js -> Form.tsx (though have not really added the types) as an example.

When you convert the source to typescript, could you rename files that contain React components to ".tsx" and rename other files to ".ts"? Best of luck and thanks for helping 😄

import validateFormData, { toErrorList } from "../validate";

export default class Form extends Component {
interface IFormProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has there been any discussion to export typings with the build or will you maintain typings within @types/react-jsonschema-form?

To add onto that, has there been any discussion regarding naming conventions for types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. It would be great to start one!

What would be the advantages/disadvantages of exporting typings with the build vs maintaining typings within @types/react-jsonschema-form? Do other libraries based in typescript typically do the former?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the advantages/disadvantages of exporting typings with the build vs maintaining typings within @types/react-jsonschema-form?

A big drawback with using DefinitelyTyped is that it's community maintained and can sometimes get out of sync with the actual library. That repository is mainly for JS packages that don't have typings for TS projects. And sometimes DefinitelyTyped can take a while to merge PR's so you'd have to wait for a release before you could use new typings.

With that in mind, it's usually better to export typings with the package so your types are always 1:1 and you don't have to maintain two separate packages.

Do other libraries based in typescript typically do the former?

Usually yeah. Check out nestjs or even vscode. Go explore some more TS packages here in GH

@epicfaace
Copy link
Member Author

superseded by #1532

@epicfaace epicfaace closed this Dec 7, 2019
@epicfaace epicfaace deleted the typescript branch May 20, 2020 21:43
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