correct type + test
This commit is contained in:
@@ -24,8 +24,9 @@ export interface UmbClassInterface extends UmbControllerHost {
|
||||
? U | undefined
|
||||
: U
|
||||
: undefined,
|
||||
R extends UmbObserverController<SpecificT> = UmbObserverController<SpecificT>,
|
||||
SpecificR = ObservableType extends undefined ? R | undefined : R,
|
||||
SpecificR = ObservableType extends undefined
|
||||
? UmbObserverController<SpecificT> | undefined
|
||||
: UmbObserverController<SpecificT>,
|
||||
>(
|
||||
// This type dance checks if the Observable given could be undefined, if it potentially could be undefined it means that this potentially could return undefined and then call the callback with undefined. [NL]
|
||||
source: ObservableType,
|
||||
|
||||
@@ -47,8 +47,9 @@ export const UmbClassMixin = <T extends ClassConstructor<EventTarget>>(superClas
|
||||
? U | undefined
|
||||
: U
|
||||
: undefined,
|
||||
R extends UmbObserverController<SpecificT> = UmbObserverController<SpecificT>,
|
||||
SpecificR = ObservableType extends undefined ? R | undefined : R,
|
||||
SpecificR = ObservableType extends undefined
|
||||
? UmbObserverController<SpecificT> | undefined
|
||||
: UmbObserverController<SpecificT>,
|
||||
>(
|
||||
// This type dance checks if the Observable given could be undefined, if it potentially could be undefined it means that this potentially could return undefined and then call the callback with undefined. [NL]
|
||||
source: ObservableType,
|
||||
|
||||
@@ -20,8 +20,9 @@ export const UmbElementMixin = <T extends HTMLElementConstructor>(superClass: T)
|
||||
? U | undefined
|
||||
: U
|
||||
: undefined,
|
||||
R extends UmbObserverController<SpecificT> = UmbObserverController<SpecificT>,
|
||||
SpecificR = ObservableType extends undefined ? R | undefined : R,
|
||||
SpecificR = ObservableType extends undefined
|
||||
? UmbObserverController<SpecificT> | undefined
|
||||
: UmbObserverController<SpecificT>,
|
||||
>(
|
||||
// This type dance checks if the Observable given could be undefined, if it potentially could be undefined it means that this potentially could return undefined and then call the callback with undefined. [NL]
|
||||
source: ObservableType,
|
||||
|
||||
@@ -180,7 +180,6 @@ describe('UmbElement', () => {
|
||||
// The controller is removed from the host, and the new one was NOT added:
|
||||
expect(hostElement.hasController(ctrl)).to.be.false;
|
||||
expect(ctrl2).to.be.undefined;
|
||||
expect(hostElement.hasController(ctrl2)).to.be.false;
|
||||
});
|
||||
|
||||
it('observe is removed when observer is undefined and using the same callback method', () => {
|
||||
@@ -197,7 +196,6 @@ describe('UmbElement', () => {
|
||||
// The controller is removed from the host, and the new one was NOT added:
|
||||
expect(hostElement.hasController(ctrl)).to.be.false;
|
||||
expect(ctrl2).to.be.undefined;
|
||||
expect(hostElement.hasController(ctrl2)).to.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user