galex
02/06/2021, 1:36 PMLifecycleOwner
declared like that:
export namespace com.company.core.livedata {
class Lifecycle {
constructor();
readonly tags: kotlin.collections.MutableMap<string, any>;
isStarted: boolean;
start(): void;
stop(): void;
addStopObserver(block: () => void): void;
notifyObserversStop(): void;
}
}
export namespace com.company.core.livedata {
interface LifecycleOwner {
readonly lifecycle: com.company.core.livedata.Lifecycle;
}
}
I just don’t manage to import it in pure React app (with typescript). I import the module like that:
import * as companycore from 'companycore';
I can find Lifecycle
class if I log the whole module:
console.log("companycore", companycore)
But not the LifecycleOwner
interface.
Any idea?Big Chungus
02/06/2021, 1:51 PMimport * as com from "companycore"
const Lifecycle = com.company.core.livedata.Lifecycle; // Class
let x: com.company.core.livedata.LifecycleOwner // type declaration
galex
02/06/2021, 3:09 PMx
to implement a class with it, as I get the following error:
'LifecycleOwner' refers to a value, but is being used as a type here. TS2749
> 17 | export class LifecyleComponent extends React.Component implements LifecycleOwner {
}
Big Chungus
02/06/2021, 3:14 PMBig Chungus
02/06/2021, 3:15 PMexternal
kotlin interfaces. maybe try adding external
to LifecyckeOwner?galex
02/06/2021, 3:16 PMBig Chungus
02/06/2021, 3:17 PMgalex
02/06/2021, 3:19 PMLifecycle
property in the class!
export class LifecyleComponent extends React.Component implements com.company.core.livedata.LifecycleOwner { }
galex
02/06/2021, 3:19 PMBig Chungus
02/06/2021, 3:19 PMBig Chungus
02/06/2021, 3:20 PMtype LifecycleOwner = com.company.core.livedata.LifecycleOwner
galex
02/06/2021, 3:20 PMturansky
02/07/2021, 2:58 AMgalex
02/07/2021, 8:20 AMturansky
02/07/2021, 8:24 AMturansky
02/07/2021, 8:28 AM