Closed bkvishe closed 7 months ago
This isn't quite right.
DoubleCsrfConfig
should be a type which reflects the configuration options where all of the options that have default values should be required and are not undefined.
You'll find that the DoubleCsrfConfigOptions
is what is used to type the actual parameter of the doubleCsrfProtection
function. These are the "options" you can (but don't have to) provide to the config. The former type is just the final expected structure of the config, where those properties are 100% expected to be there, regardless of whether or not they were passed in.
This type exists:
export type DoubleCsrfConfigOptions = Partial<DoubleCsrfConfig> & {
getSecret: CsrfSecretRetriever;
};
The types allow to differentiate between what needs to be passed in (argument type) vs what the object is regardless of what is passed in (argument type merged with defaults).
Closing this as the optional and partial types are available / existing and this PR is changing a type that is correct / intentional.
Made modifications to the
DoubleCsrfConfig
interface, indicating keys as optional based on the documentation where they are proposed as optional and have default values.