fix(platform-browser): export deprecated TransferState as type (#50015)

Prior to this commit `TransferState` re-export could not be used as a type.

Closes #50014

PR Close #50015
This commit is contained in:
Alan Agius
2023-04-26 14:59:11 +00:00
committed by Dylan Hunn
parent a15294009f
commit 74c925c19c
3 changed files with 12 additions and 12 deletions
@@ -235,6 +235,9 @@ export class Title {
}
// @public @deprecated
export type TransferState = TransferState_2;
// @public (undocumented)
export const TransferState: {
new (): TransferState_2;
};
@@ -47,6 +47,8 @@ export const makeStateKey = makeStateKeyFromCore;
* instead.
*/
// The below is a workaround to add a deprecated message.
export type TransferState = TransferStateFromCore;
// The below type is needed for G3 due to JSC_CONFORMANCE_VIOLATION.
export const TransferState: {new (): TransferStateFromCore} = TransferStateFromCore;
/**
@@ -11,6 +11,8 @@ import {Compiler, Component, ComponentFactoryResolver, CUSTOM_ELEMENTS_SCHEMA, D
import {fakeAsync, getTestBed, inject, TestBed, tick, waitForAsync, withModule} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {TransferState} from '../public_api';
// Services, and components for the tests.
@Component({selector: 'child-comp', template: `<span>Original {{childBinding}}</span>`})
@@ -46,18 +48,6 @@ class MyIfComp {
class ChildChildComp {
}
@Component({
selector: 'child-comp',
template: `<span>Original {{childBinding}}(<child-child-comp></child-child-comp>)</span>`,
})
@Injectable()
class ChildWithChildComp {
childBinding: string;
constructor() {
this.childBinding = 'Child';
}
}
class FancyService {
value: string = 'real value';
getAsyncValue() {
@@ -1057,5 +1047,10 @@ Did you run and wait for 'resolveComponentResources()'?`);
/Cannot override template when the test module has already been instantiated/);
});
});
it('TransferState re-export can be used as a type and contructor', () => {
const transferState: TransferState = new TransferState();
expect(transferState).toBeDefined();
});
});
}