question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert packages to TypeScript

See original GitHub issue

Overview

One of our Q1 2019 goals is to convert our packages’ JS to TypeScript, as an increasing number of our consumers have TypeScript codebases and would benefit from this change.

The primary goal is to convert the packages themselves - converting the unit tests would be a plus (and would likely help test the conversion) but ideally we should be able to first convert packages one-by-one and continue to test them with the existing JS unit tests to confirm no unintended changes.

The intent of this conversion is ideally to involve no breaking changes, and to continue to provide both the ES6 and ES5 formats that we currently distribute in addition to TS.

This is a master issue for tracking all packages during the conversion, rather than creating 20 separate issues. I’m listing the components with JS below in a rough chronological order of approach (generally prioritizing dependencies ahead of dependents).

Packages to convert

Additional tasks

  • Replace Object.assign with spread where possible (@acdvorak, #4389)
  • Create factory type definitions for components that need them (e.g., MDCRippleFactory) (@acdvorak, #4407)
  • Move component definitions from index.ts to component.ts (@acdvorak, #4407)
  • Standardize interface and type names (e.g., ~Point, MenuPoint, or~ MDCMenuPoint) (@acdvorak, #4407)
  • Create *EventDetail interfaces for all custom events that emit a detail property, and use generic signature of emit<*EventDetail>() to prevent accidental type errors (@acdvorak, #4407)
  • Fix internal linter errors (@acdvorak, #4440)
  • Clean up mentions of JS from scripts / configs after everything in packages is TS (@moog16, #4435)
  • Update docs (readme, getting-started, importing-js, best practices, etc.) (@moog16, #4432)
  • Review check-imports.js script and ensure it is still working

Packages to remove

We should consider removing the following deprecated packages rather than spending time converting them:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
acdvorakcommented, Feb 28, 2019

Pre-release version 1.0.0-0 has been published on npm 🎉

1reaction
moog16commented, Feb 23, 2019

@gugu - did you see changes outlined in #4409? We’re also using tsc to achieve smaller file sizes, and allow for tree-shaking. I haven’t measured the file sizes, but I’m sure it is smaller than the UMD bundles.

Yes we are not removing webpack from our build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Migrating from JavaScript - TypeScript
Converting a JavaScript codebase over to TypeScript is, while somewhat tedious, usually not challenging. In this tutorial, we're going to look at how...
Read more >
Converting a Javascript project to Typescript - Medium
Step 2: Replace any dependencies with the respective TypeScript version. Most of the packages that are publicly available through package ...
Read more >
js-to-ts-converter - npm
Small utility to rename .js->.ts, and convert ES6 classes to TypeScript classes by filling in property declarations.
Read more >
8 Tips for Converting That Big Project to TypeScript
Most of the plugin packages follow a common structure. This created an opportunity for us to convert multiple files at once. Try creating...
Read more >
A simple guide for migrating from JavaScript to TypeScript
In that file, simply write declare module "my-module" (with the “my-module” being the package that doesn't have Typescript). Then, in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found