Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example that shows how to add more strict type checks for t.meta, ClientFunction.dependencies and so on #72

Closed
andrzej-woof opened this issue Apr 22, 2022 · 1 comment · Fixed by #86
Assignees
Labels
help wanted Extra attention is needed TYPE: enhancement

Comments

@andrzej-woof
Copy link

andrzej-woof commented Apr 22, 2022

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

@felis2803
Copy link
Contributor

@andrzej-kodify Thank you for the suggestion.

@helen-dikareva helen-dikareva added the help wanted Extra attention is needed label Jul 7, 2022
@AndreyBelym AndreyBelym transferred this issue from DevExpress/testcafe Nov 4, 2022
@AndreyBelym AndreyBelym changed the title Typescript: allow strict typing of test and fixture meta and ctx Add an example that shows how to add more strict type checks for t.meta, ClientFunction.dependencies and so on Nov 4, 2022
@Bayheck Bayheck mentioned this issue Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed TYPE: enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants