Ensure that the TheiaAppFactory type does match the constructor function of TheiaApp. InitialWorkspace is required in the TheiaApp constructor butwas optional in TheiaAppFactory This ensures that (sub)classes of TheiaApp can properly be used as app factory without type casting
Contributed on behalf of STMicroelectronics
How to test
Using the TheiaAppLoader with a TheiApp (sub)class as factory parameter should now work and not have a ts error:
// Mock playwright args
cons args= {} as TheiaPlaywrightTestConfig & PlaywrightWorkerArgs
// Simle test
const app= TheiaAppLoader.load({playwright,browser}, undefined, TheiaApp)
// test with subclass
class SpecialTheiaApp extends TheiaApp{
}
const app:SpecialTheiaApp= TheiaAppLoader.load({playwright,browser}, undefined, SpecialTheiaApp)
On master this would throw a compile error and a cast like `SpecialTheiaApp as TheiaAppFactory<SpecialApp>` would required
Follow-ups
Review checklist
[x] As an author, I have thoroughly tested my changes and carefully followed the review guidelines
What it does
Ensure that the
TheiaAppFactory
type does match the constructor function of TheiaApp.InitialWorkspace
is required in the TheiaApp constructor butwas optional inTheiaAppFactory
This ensures that (sub)classes of TheiaApp can properly be used as app factory without type castingContributed on behalf of STMicroelectronics
How to test
Using the TheiaAppLoader with a
TheiApp
(sub)class as factory parameter should now work and not have a ts error:Follow-ups
Review checklist
Reminder for reviewers