refactor: unifies spread types in their proper places #2067
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's a large TypeScript refactoring that includes every single
*.ts
file in the entire project.Why?
Many types are confusing because they are redefined several times, for example:
Pool
types are spread and defined inindex.d.ts
,typings/mysql/index.d.ts
andtypings/mysql/lib/Pool.d.ts
at the same timeConnection
,ConnectionOptions
,execute
,query
, etc.execute
andquery
are complex and have to do several ctrl + c and v around the typesTo consider
Connection
? It's simple: go toConnection.d.ts
file π¨π»βπ»CI
npm run lint:code
now checks for every*.ts
file (including the tests)What does this refactoring change?
β These changes resolves 100% of
eslint
errors in*.ts
β Unifies the types in their proper places:
Pool
as example: now, all typings are defined intypings/mysql/lib/Pool.d.ts
execute
andquery
overloads too. Now both can be reused:execute
orquery
, it will automatically affect all types that need it (Connection
,PoolConnection
, etc.) π€Ήπ»ββοΈβ Increments
NodeNext
TypeScript compatibility by requires the.js
in local imports for*.ts
filesβ Resolves circular imports in every
*.ts
fileβ Patterns all imports as
import any from './'
import any = require('./')
βΉοΈ Removes older TypeScript tests that are unused
@types/mocha
,@types/chai
,mocha
andchai
dependenciesLastly
It's the new index.d.ts: