testcafe
testcafe copied to clipboard
Typescript: allow strict typing of test and fixture `meta` and `ctx`
What is your Scenario?
I want to have strict type definition for meta object in order to set some properties only within given type boundaries and get utilize IDE suggestions to ease up writing test code For example:
fixture('Fixture');
test('Test', async () => {}).meta({ target: 'staging' });
I want to enforce the type target: 'staging' | 'local';
In addition I'd suggest similar for test/fixture ctx object as I'm setting some shared context properties in before hook
What are you suggesting?
I'm not sure what would be the best way to achieve that
Maybe expose generic meta<T>(data: T) functions
No clue about best approach for ctx
What alternatives have you considered?
I have to cast everywhere to benefit from static checks and suggestions
Additional context
No response
@andrzej-kodify Thank you for the suggestion.