Hi! I've started a rewrite of core classes into typescript today. It'll be a limited refactoring work with the limited goal of:
1) Break out Table, Collection, WhereClause, Transaction, Version into their own ts classes
2) Break out types and interfaces from Dexie.d.ts into separate files. Let build script copy Dexie.d.ts with its dependencies into dist.
3) Update build process to use imported helper library and bundle the helper using rollupjs.
The outcome should be an identical library that passes all tests and hopefully does not increase too much in size.
Nothing committed so far. Will probably live in a branch named something like "refactor-classes-ts" or similar. Hoping to get it done within a week or so.
Hey @dfahlander ,
What TypeScript-Version are you targeting? I had a look in package.json and the version there is 2.1.4. In case the changes lead to a new major version of Dexie being released, we might want to target a newer TS version. Maybe 2.4. There are some nice new features in there like strictNullChecks and string enums and overall better type checking.
@nponiros Thanks for noticing. I've worked towards version 2.6.2 but I seem to have missed updating package.json.
Status now is that all used to compile recently but there I'm not sure right now is it still does. Pretty much everything is done but working with how to bundle src/public/types into dexie.d.ts and been struggeling with backward compatibility for the old namespace style d.ts (module Dexie {...}).
I was hoping to get all done before Xmas but the rewrite was bigger than I thought. It will be exciting to see how unit tests acts when done with the dts bundling and updated build script.
However, will take a code pause now over the holidays and probably until after new years eve.
Have some uncommitted stuff though that I might commit on Xmas day.
I wonder if it is worth the trouble to try getting the new code working with the old type definitions. Have you tried letting TypeScript create the type definition files and see if those pass the unit tests?
I do understand the point of backwards compatibility but if that gets too complex it will make it more difficult in the future to move forward using features from newer compiler versions. It will probably also make it more difficult to just implement new features since (if I understand correctly) we would also have to manually write .d.ts files. Maybe breaking backwards compatibility is a good idea in this case. Just my two cents :)
Now done refactoring and merged it into master. Puh. That was some work...
The master branch is represents a future version 3.0.0-alpha.1.
To fix issues in version 2.x, use the master-2 branch.
great job friend 馃帄 congratz!
Most helpful comment
Now done refactoring and merged it into master. Puh. That was some work...
The master branch is represents a future version 3.0.0-alpha.1.
To fix issues in version 2.x, use the master-2 branch.