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

Convert to TypeScript and use seatsio-types #135

Merged
merged 40 commits into from
Oct 24, 2023
Merged

Conversation

mortendevold
Copy link
Contributor

This PR converts the project to TypeScript and implements @seatsio/seatsio-types 0.3.2. Tested in playground as well as seatsio-webapp with local "link:.." in package.json.

@mortendevold
Copy link
Contributor Author

@mortendevold
Copy link
Contributor Author

I was seeing that same error, have you ran yarn in seatsio-react as well? I added some type packages

@mroloux
Copy link
Member

mroloux commented Oct 20, 2023

Yeah, I even removed the node_modules folder.

@mortendevold
Copy link
Contributor Author

I just installed the latest IntelliJ and opened the project there. Works as expected, so not sure what the difference is. Will try killing node_modules in both seatsio-react and playground and reinstall.

@mroloux
Copy link
Member

mroloux commented Oct 20, 2023 via email

@mortendevold
Copy link
Contributor Author

mortendevold commented Oct 20, 2023

Had some missing types in root package.json (probably after solving conflicts after merge from master). If you pull the latest, do the errors go away? See another issue though, I now get intellisense in VSCode, but not in IntelliJ. Investigating.

UPDATE: Seems like IntelliJ gives suggestions for for instance language={"en"}, but not when using without curlies (language="en"). Do you see the same?

@mroloux
Copy link
Member

mroloux commented Oct 20, 2023

Screenshot 2023-10-20 at 15 43 36

@mroloux
Copy link
Member

mroloux commented Oct 20, 2023

Had some missing types in root package.json (probably after solving conflicts after merge from master). If you pull the latest, do the errors go away? See another issue though, I now get intellisense in VSCode, but not in IntelliJ. Investigating.

Awesome, that fixed it 👍

@mortendevold
Copy link
Contributor Author

mortendevold commented Oct 20, 2023

Screenshot 2023-10-20 at 15 43 36

Yeah, if you instead use language={"en"} it seems to provide suggestions. VSCode does not seem to require this. Not sure if it's a setting in IntelliJ

@mroloux
Copy link
Member

mroloux commented Oct 23, 2023

Works like a charm 👍 👍 👍

One question though: do we need Babel, Webpack and rimraf? What's the advantage over just running tsc?

@mortendevold
Copy link
Contributor Author

Works like a charm 👍 👍 👍

One question though: do we need Babel, Webpack and rimraf? What's the advantage over just running tsc?

TSC will only transpile into JavaScript, nothing more. If we want to focus on being a library that users will package on their own, I guess that is fine. Babel/Webpack handles minification, polyfills for older browsers etc. We might not need it for this small project, but I don't think it matters if we keep it. Rimraf is just a convenience package, cleaning the output folder before each build (essentially platform safe rm -rf, which also gives it its name)

@mroloux
Copy link
Member

mroloux commented Oct 23, 2023

If we don't need Babel and Webpack I say we remove them - simpler is better, right? 😉 Then we don't need to keep upgrading the versions of those packages for example.

Our clients will be using a minifier anyways, when they're packaging our react lib in their app. Polyfills shouldn't be needed as far as I know - and if our customers really need them they can configure their own bundler to include them.

(I might be missing something obvious here of course, but I didn't see an immediate need for Babel/Webpack in this particular project, if we're on TS).

@mortendevold
Copy link
Contributor Author

I've moved the test to TypeScript, and now use ts-jest to run them. Seems to work well, so I've removed everything related to Webpack and Babel. We should consider if we want to ship each transpiled file in a lib folder in addition to the build bundle. That would allow importing just what you need by using for instance import SeatsioSeatingChart from '@seatsio/seatsio-react/lib/SeatsioSeatingchart'

@mroloux
Copy link
Member

mroloux commented Oct 23, 2023

seatsio/seatsio-react/lib/SeatsioSeatingchart

Yeah, that's something we could look into in a followup PR

@mortendevold
Copy link
Contributor Author

Found that using just tsc to output a single file only allows AMD or SystemJS, which is not something we want. Will have to revert to using webpack to get a sensible module format. Currently running into an issue where types are not working, so looking into what's wrong.

@mroloux
Copy link
Member

mroloux commented Oct 24, 2023

Found that using just tsc to output a single file only allows AMD or SystemJS, which is not something we want. Will have to revert to using webpack to get a sensible module format. Currently running into an issue where types are not working, so looking into what's wrong.

Ok, but why does it need to be a single file? Does tsc not output JS files with standard JS modules?

@mortendevold
Copy link
Contributor Author

Found that using just tsc to output a single file only allows AMD or SystemJS, which is not something we want. Will have to revert to using webpack to get a sensible module format. Currently running into an issue where types are not working, so looking into what's wrong.

Ok, but why does it need to be a single file? Does tsc not output JS files with standard JS modules?

Doesn't have to, we can of course create separate JS + .d.ts files. Right now the biggest issue is figuring out why type suggestions have gone out the window.

@mortendevold mortendevold merged commit 69d0b66 into master Oct 24, 2023
1 check passed
@mortendevold mortendevold deleted the morten/typings-2 branch October 24, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants