sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.73k stars 600 forks source link

Can sitespeed support TypeScript files for better maintainability of measurement scripts? #3799

Open linqunhe opened 1 year ago

linqunhe commented 1 year ago

Feature/improvement

Can sitespeed support TypeScript files for maintaining measurement scripts? Currently, without TypeScript, as the number of test scenarios increases, the maintainability of the project becomes very poor. There is no intelligent hinting, no type constraints, and it brings high costs for collaborative work among multiple people.

Thanks...

soulgalore commented 1 year ago

Hi @linqunhe yes that is a good idea. I actually started a couple of years ago adding a types to scripting so that could be used from IDE's. I felt I needed help from someone that worked with TypeScript. I can help/guide and then maintain but I need help with the first setup.

soulgalore commented 8 months ago

I restructured some code in Browsertime to make it easier to add typescript definition files for context/commands in https://github.com/sitespeedio/browsertime/pull/2047 - when definition files exists for those two objects, it is easy to get code completion in Visual Studio Code.

soulgalore commented 8 months ago

@linqunhe please try out the latest version and https://www.sitespeed.io/documentation/sitespeed.io/scripting/tutorial-08-Setting-Up-IntelliSense.html for setting it up. Code completion work for scripting now with just enough Typescript.