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

Add basic typescript integration #565

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

isidornygren
Copy link

Adds settings for ESLint and webpack to build typescript (.ts, .tsx) files. Building the project should work just as before.

The type declarations in src/types/cockpit.d.ts are very basic and should preferably not be used, I just added them to at least have some types for the library.

@isidornygren isidornygren mentioned this pull request Apr 21, 2022
@martinpitt
Copy link
Member

Thanks At the moment this breaks tests rather thoroughly 😢 Note that the cockpit.ts annotation does not really belong here into starter-kit, it should live in cockpit itself. Someone originally attempted this in cockpit-project/cockpit#13214 , but did not get that far. But it's already a whole lot more than the stub here 😁

How much does .ts make sense without a typescript annotation for cockpit.js? Does this have to be strictly hieararchical, i.e. dependencies first? Or can it just ignore all the cockpit.*() calls?

@isidornygren
Copy link
Author

isidornygren commented Apr 25, 2022

Thanks At the moment this breaks tests rather thoroughly 😢 Note that the cockpit.ts annotation does not really belong here into starter-kit, it should live in cockpit itself. Someone originally attempted this in cockpit-project/cockpit#13214 , but did not get that far. But it's already a whole lot more than the stub here 😁

How much does .ts make sense without a typescript annotation for cockpit.js? Does this have to be strictly hieararchical, i.e. dependencies first? Or can it just ignore all the cockpit.*() calls?

I agree that the types for cockpit should live in its own project repo. I think it should be possible - although not ideal - to have an untyped library, so that "typings" file should probably be removed 😅 . I agree that it would be neat to have typings in the cockpit project before implementing something like this - I've played around a bit with typings locally and might push something to the cockpit repo if I can make them sufficiently mature.

I'm a bit unsure about the tests though as I haven't been able to run them locally, and I'm not sure what's going on from reading the test details from the failed tests. If you could push me in the right direction to what the error might be / how to debug the tests I would be happy to fix whatever's happening.

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.

None yet

2 participants