-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.1 doesn't work with Typescript #936
Comments
related issue microsoft/TypeScript#3610 |
also just one more note, older versions of skate did work with Typescript |
Would be nice to have this fixed. |
@Hotell please check it PR #932 (Cache propConfigs returned from static get props) |
I made work around. check this change. |
nice @vvakame! , you don't need to import tslib manually, just hit |
@Hotell I tried it now. but it doesn't work as expected.
I feel that the generated code changes when I tried |
yeah doesn't work for me as well :( so we have to manually import |
@Hotell I would not change the prototype of your derived class to be the prototype of your base class. You need to maintain the correct prototype chain in place. `
}; |
that doesn't work @andreawyss for now I'm rather overriding typescript Works like a charm, although yeah I'm not big fan of using function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
(window as any).__extends = _inherits; |
@Hotell I Yes, I like it. When you tried my version did you check the one that skips over 'length', 'name', 'prototype' ?
|
so I can add to docs how to skate 4.1 work with TS, WDYT @treshugart ?, because I don't think that this will be fixed anytime soon within TS, because it would be a huge Breaking Change |
Nope, but anyway, that's to much nitpicking magic for my taste, I think by using Babel's inherits method, the problem is solved at this moment. WDYT? If @treshugart gives me a GO, I'll submit PR to docs |
@Hotell I think you should give it a try. But yes, now I understand the reason why static class member should be enumerable=false and I agree that this is something that TypeScript will needs to address. |
@Hotell go for it. I think it's at least a good starting point for now, that matches the current state of affairs. Hopefully this will be addressed soon. This feels like a refactor to TS would solve this? cc @andreawyss |
Yes, TS is still incorrectly generating static class member properties enumerable=true. |
yup (breaking)change on TS side is needed |
We'll be discussing this in the near future. This might be something to keep an eye out for in the 2.2 timeframe. |
Going to close this as it seems we've gotten as far as we can. As per #972 we're going to try Flow as well and see how that works out. We can always switch later after we've had experience trying both. |
FYI: microsoft/TypeScript#12488 this issue will be solved in TypeScript 2.2 |
The new implementation of API on prototype doesn't work with Typescript which is very unfortunate.
Problem is probably in Typescript implementation of
extends
.It works only with old skate js API's ( define and definition via object )
Short description of possible issue:
problem starts here ( within
connectedCallback
): https://github.com/skatejs/skatejs/blob/master/src/api/component.js#L186which calls
syncPropsToAttrs(this)
, wherethis
is the custom element constructor. Problem is that there is noprops
static property on it so this call (https://github.com/skatejs/skatejs/blob/master/src/api/component.js#L34) will returnundefined
and when you callundefined
.forEach well it throws...Here is the repo which reproduces the error:
https://github.com/Hotell/skate-and-raw-WC
and here is skate component https://github.com/Hotell/skate-and-raw-WC/blob/master/src/app/skate-wc/yo-smile/YoSmile.tsx
just hit
yarn
||npm i
to install dependencies, thenyarn start
||npm start
and open devTools, to debug it.The text was updated successfully, but these errors were encountered: