Skip to content

Commit 1d7761c

Browse files
committed
Update type and doc for removing values from config
1 parent 410bbf7 commit 1d7761c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ const { sub: visitorId } = await jwt.decode(token);
183183
*/
184184
res.send({ foo: 'bar' }); // will save foo in the installation config.
185185
// or
186+
res.send({ foo: null }); // will remove foo from the installation config.
187+
// or
186188
res.sendFailed('This step has failed validation.'); // prevent the installer from progressing.
187189

188190
/**

src/sdk/handlers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import EnvoyResponse, {
2424

2525
type SomeObject = Record<string, unknown>;
2626

27+
type Nullable<T> = {
28+
[P in keyof T]: T[P] | null;
29+
};
30+
2731
type Result = Promise<void> | void;
2832

2933
/**
@@ -94,7 +98,7 @@ export type SelectedValuesRouteHandler<Config = SomeObject, Additions = SomeObje
9498
* @category Handler
9599
*/
96100
export type ValidationRouteHandler<Config = SomeObject, Payload = SomeObject, Additions = SomeObject> =
97-
(req: EnvoyValidationRouteRequest<Payload, Config> & Additions, res: EnvoyResponse<Partial<Config>>) => Result;
101+
(req: EnvoyValidationRouteRequest<Payload, Config> & Additions, res: EnvoyResponse<Nullable<Partial<Config>>>) => Result;
98102

99103
/**
100104
* Wraps any express.js-based handlers

0 commit comments

Comments
 (0)