README
mixin-patch
Patch the mixin problem #28799
main goal
Patch the problem described in issue #28799 of Typescript development team
When you use several stacked Mixins using TypeScript 2.2+ Support for Mix-in classes you can get this kind of error:
- error TS2425: Class '{ someName(): ... } & { someName:(()....' defines instance member property 'someName', but extended class 'className' defines it as instance member function.
usage
- include in
package.json ⟶ devDependencies
- add
& mixin-patch
at the end of the"build"
script (for example:"build": "tsc & mixin-patch"
)
mixin-patch
Mixin-patch patch all of .d.ts
with these steps:
- It reads
package.json
of the project in the current work directory - Take the directories of the
"files"
entry - Search for
.d.ts
files in those directories (recursively) - Patch each
.d.ts
adding a comment// mixin-patch
at the beginning of each offending line - Uses
/^(\s+)(\w+:\s*\([^;]*\) => [^;]*;\s*)$/mg
regex to detect offending lines
caveats
- multiline emitted member function are not patched
license
- MIT