Skip to content

Conversation

addaleax
Copy link
Collaborator

No description provided.


beforeEach(function () {
config = instanceState.context.config;
config = instanceState.shellApi.config;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if all the previous assertions were running on instanceState.context, i expect either them to be wrong/fail or something i am not able to follow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, these are the same objects, except that using .shellApi instead of .context makes this typesafe

.context is the global object in which shell commands are being executed, it more or less has to be typed as any, and properties from .shellApi are just copied over to it:

this.context = contextObject;
Object.assign(contextObject, this.shellApi);

Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

@addaleax addaleax merged commit 4f9f6bf into main Jul 30, 2024
68 of 71 checks passed
@addaleax addaleax deleted the strict-ts-shell-api-sp branch July 30, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants