Conversation
If we enable power-assert, some tests cannot be succeed. We need to clarify it. But we disable it to proceed to convert TypeScript.
|
r? @azu |
|
Thanks. |
| getState() { | ||
| return this._storeGroup.getState(); | ||
| getState<T>(): T { | ||
| return (this._storeGroup as any).getState(); // TODO: remove casting `any` |
There was a problem hiding this comment.
📝 I have no idea about this.
Can we remove this casting by some changes?
There was a problem hiding this comment.
I thought to introduce some new interfaces which is implemented by StoreGroup or Store to fix it.
Perhaps is it not a right way?
| * @public | ||
| */ | ||
| export default class Store extends Dispatcher { | ||
| abstract class Store extends Dispatcher { |
There was a problem hiding this comment.
Store is not abstruct in some test case.
Line 12 in e2daa2f
Is it valid in TypeScript?
Of course, Store is just abstract in most case without testing, I think.
Should we will modify test code?
There was a problem hiding this comment.
Is it valid in TypeScript?
"At this time", it's valid in TypeScript because we keep all unit test cases as plain js.
However, of course, we need to add class TestStore extends Store to them if we convert test cases to TypeScript.
azu
left a comment
There was a problem hiding this comment.
Ok. I've checked this PR.
The first overview is looks good to me.
Thanks for nice work.
| } | ||
|
|
||
| name: string; | ||
| displayName: string; |
| * unique id in each UseCase instances. | ||
| */ | ||
| id: string; | ||
| displayName: string; |
|
I've merged this. Next StepsWe will continue to investigate following TODO issues. |
Abstract
d.tsin npm, we need push more patch onto this.Motivation
Detailed Design
Change build system
This introduces 2-phase build system.
src/withtscand emit a plain JS code into/__obj/temp dir.In this phase, this also try to copy all javascript file into
/__obj/to keep the content of/src/.babeland emit the transformed one into/lib/.By this change, we can achive to convert our source code to TypeScript incrementally without at giant single patch file.
Unit tese imports from
/lib/By the above change, we need to load the code to test unit tests for incremental converting without changeing
unit tests.
Convert TypeScript
Convert
*.jsto*.tssimply.This change escapes from the problem which is that some dependency does not have any
d.tsby dirty hacking.Add
*.d.tsand*.jswith same name. TypeScript compiler uses*.d.tsto resolve type checking.But we use
*.jsfile to load a file actually on the runtime. This dirty hack resolves the problem.Drawback
Alternative Approach
But this tries to use TypeScript by conversations with @azu.
Unresolved Items
*.d.tsfiles into/lib/: feat(typescript): add d.ts to pacakge.json #78.anytype from public APIs:abstractcorrectly.