Skip to content

Commit 6784e67

Browse files
fix(components/config): revert accidental breaking change resulting from the SkyAppRuntimeConfigParams.get method's return type (#534)
1 parent 7ab34cc commit 6784e67

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libs/components/config/src/lib/params.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ describe('SkyAppRuntimeConfigParams', () => {
137137
}
138138
);
139139

140+
// TODO: In a breaking change, remove the `as unknown` declarations.
140141
expect(params.get('a1')).toBe('b');
141-
expect(params.get('a2')).toBe(undefined);
142+
expect(params.get('a2') as unknown).toBe(undefined);
142143
expect(params.get('a3')).toBe('d');
143144
expect(params.get('a4')).toBe('x');
144-
expect(params.get('a5')).toBe(undefined);
145+
expect(params.get('a5') as unknown).toBe(undefined);
145146
});
146147

147148
it('should allow default values to be overridden by the query string', () => {

libs/components/config/src/lib/params.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,20 @@ export class SkyAppRuntimeConfigParams {
121121
* Returns the decoded value of the requested param.
122122
* @param key The parameter's key.
123123
*/
124-
public get(key: string): string | undefined {
124+
public get(key: string): string {
125125
if (this.has(key)) {
126126
return decodeURIComponent(this.#params[key]);
127127
}
128-
return;
128+
129+
// TODO: Return `string | undefined` in a breaking change.
130+
return undefined as unknown as string;
129131
}
130132

131133
/**
132134
* Returns the params object.
133135
* @param excludeDefaults Exclude params that have default values
134136
*/
137+
// TODO: Return a more specific type in a breaking change.
135138
public getAll(excludeDefaults?: boolean): Object {
136139
const filteredParams: { [key: string]: string } = {};
137140

0 commit comments

Comments
 (0)