Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aleclarson
Copy link
Contributor

@aleclarson aleclarson commented Feb 4, 2025

While process.env (from @types/node) has Record<string, string | undefined> type, the env argument of @hattip/adapter-test expects a Record<string, string> type. I believe this is more strict than necessary. It'd be great to be able to pass process.env in without a type assertion.

Note: This builds upon #197 and so that PR should be merged first. Only this commit is relevant to this PR.

The `AdapterRequestContext#env` method uses this interface to provide type safety at compile-time. It allows the user to make certain assumptions about the existence of particular environment variables.
},
env(variable) {
return env[variable];
return env[variable] as any;
Copy link
Contributor Author

@aleclarson aleclarson Feb 4, 2025

Choose a reason for hiding this comment

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

Due to #197's changes to the return type of env(), we have to cast to any.

Actually, this might belong in #197 (not sure).

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.

1 participant