Migrating to Typescript
Closed this issue · 0 comments
jaredwray commented
The branch typescript
is to migrate this project from javascript to typescript
. Please feel free to contribute to this branch and pull request as needed. Here are the steps that we would like to take. This will be the v8.3.0
release being planned.
Benfits
- Cleaner code base with types
- Type definitions built right in
Steps
- Add in dist folder and get setup
- Add in build task in package.json
- Update workflow test to handle
build
- setup tsconfig
- move tests to point to
dist/index.js
instead ofsrc/index.ts
temporarily - Update / Convert
index.js
toindex.ts
-- once this is done and compiling correctly it should be validated and working against this pull request tests. Refer toMigration of index.js to index.ts
below. - Update / Convert tests to typescript. Refer to
Migration of tests to typescript
- Move tests to point to
index.ts
instead ofdist/index.js
- Validate that code coverage is 100%
- Update version to
v8.3.0
and release
Migration of index.js
to index.ts
There are a couple of things that will need to be done here:
- Once the file is renamed it will have many errors
- It looks like
clone-response
does not have type definition. I would prefer that we remove this dependency and just look to duplicate the logic in this file. You can look at the project as it is a small amount of code to refactor here. - In addition it looks like
Keyv
is not working correctly with types. Please do a pull request on Keyv to fix this. - Create an class for
options
so it is defined correctly - Fix all other issues so it compiles and tests 100% against the current testing framework.
For this index migration do not worry about code coverage as we will take care of that in a later step.
Migration of Tests to Typescript
Currently this is using Ava and it does look like ava supports typescript with some refactoring. In some cases there are additional packages that will need the type definitions added and supported.