Skip to content

Commit e556376

Browse files
committed
refactor: replace any types
1 parent 521f399 commit e556376

28 files changed

+81
-79
lines changed

projects/angular-auth-oidc-client/src/lib/api/data.service.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('Data Service', () => {
2929

3030
describe('get', () => {
3131
it('get call sets the accept header', waitForAsync(() => {
32-
const url = 'anyurl';
32+
const url = 'testurl';
3333

3434
dataService
3535
.get(url, { configId: 'configId1' })
@@ -47,7 +47,7 @@ describe('Data Service', () => {
4747
}));
4848

4949
it('get call with token the accept header and the token', waitForAsync(() => {
50-
const url = 'anyurl';
50+
const url = 'testurl';
5151
const token = 'token';
5252

5353
dataService
@@ -67,7 +67,7 @@ describe('Data Service', () => {
6767
}));
6868

6969
it('call without ngsw-bypass param by default', waitForAsync(() => {
70-
const url = 'anyurl';
70+
const url = 'testurl';
7171

7272
dataService
7373
.get(url, { configId: 'configId1' })
@@ -86,7 +86,7 @@ describe('Data Service', () => {
8686
}));
8787

8888
it('call with ngsw-bypass param', waitForAsync(() => {
89-
const url = 'anyurl';
89+
const url = 'testurl';
9090

9191
dataService
9292
.get(url, { configId: 'configId1', ngswBypass: true })
@@ -107,7 +107,7 @@ describe('Data Service', () => {
107107

108108
describe('post', () => {
109109
it('call sets the accept header when no other params given', waitForAsync(() => {
110-
const url = 'anyurl';
110+
const url = 'testurl';
111111

112112
dataService
113113
.post(url, { some: 'thing' }, { configId: 'configId1' })
@@ -123,7 +123,7 @@ describe('Data Service', () => {
123123
}));
124124

125125
it('call sets custom headers ONLY (No ACCEPT header) when custom headers are given', waitForAsync(() => {
126-
const url = 'anyurl';
126+
const url = 'testurl';
127127
let headers = new HttpHeaders();
128128

129129
headers = headers.set('X-MyHeader', 'Genesis');
@@ -143,7 +143,7 @@ describe('Data Service', () => {
143143
}));
144144

145145
it('call without ngsw-bypass param by default', waitForAsync(() => {
146-
const url = 'anyurl';
146+
const url = 'testurl';
147147

148148
dataService
149149
.post(url, { some: 'thing' }, { configId: 'configId1' })
@@ -160,7 +160,7 @@ describe('Data Service', () => {
160160
}));
161161

162162
it('call with ngsw-bypass param', waitForAsync(() => {
163-
const url = 'anyurl';
163+
const url = 'testurl';
164164

165165
dataService
166166
.post(

projects/angular-auth-oidc-client/src/lib/api/data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class DataService {
2626

2727
post<T>(
2828
url: string | null,
29-
body: any,
29+
body: unknown,
3030
config: OpenIdConfiguration,
3131
headersParams?: HttpHeaders
3232
): Observable<T> {

projects/angular-auth-oidc-client/src/lib/api/http-base.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { Observable } from 'rxjs';
66
export class HttpBaseService {
77
private readonly http = inject(HttpClient);
88

9-
get<T>(url: string, params?: { [key: string]: any }): Observable<T> {
9+
get<T>(url: string, params?: { [key: string]: unknown }): Observable<T> {
1010
return this.http.get<T>(url, params);
1111
}
1212

1313
post<T>(
1414
url: string,
15-
body: any,
16-
params?: { [key: string]: any }
15+
body: unknown,
16+
params?: { [key: string]: unknown }
1717
): Observable<T> {
1818
return this.http.post<T>(url, body, params);
1919
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export interface AuthOptions {
22
customParams?: { [key: string]: string | number | boolean };
3-
urlHandler?(url: string): any;
3+
urlHandler?(url: string): void;
44
/** overrides redirectUrl from configuration */
55
redirectUrl?: string;
66
}
77

88
export interface LogoutAuthOptions {
99
customParams?: { [key: string]: string | number | boolean };
10-
urlHandler?(url: string): any;
10+
urlHandler?(url: string): void;
1111
logoffMethod?: 'GET' | 'POST';
1212
}

projects/angular-auth-oidc-client/src/lib/auth.module.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212

1313
describe('AuthModule', () => {
1414
describe('APP_CONFIG', () => {
15-
let config: any;
16-
1715
beforeEach(waitForAsync(() => {
1816
TestBed.configureTestingModule({
1917
imports: [AuthModule.forRoot({ config: { authority: 'something' } })],
@@ -27,7 +25,8 @@ describe('AuthModule', () => {
2725
});
2826

2927
it('should provide config', () => {
30-
config = TestBed.inject(PASSED_CONFIG);
28+
const config = TestBed.inject(PASSED_CONFIG);
29+
3130
expect(config).toEqual({ config: { authority: 'something' } });
3231
});
3332

projects/angular-auth-oidc-client/src/lib/callback/interval.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ export class IntervalService {
3939
});
4040
}
4141
}
42+

projects/angular-auth-oidc-client/src/lib/config/auth-well-known/auth-well-known-data.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('AuthWellKnownDataService', () => {
107107
(service as any)
108108
.getWellKnownDocument('anyurl', { configId: 'configId1' })
109109
.subscribe({
110-
next: (res: any) => {
110+
next: (res: unknown) => {
111111
expect(res).toBeTruthy();
112112
expect(res).toEqual(DUMMY_WELL_KNOWN_DOCUMENT);
113113
},
@@ -144,7 +144,7 @@ describe('AuthWellKnownDataService', () => {
144144
);
145145

146146
(service as any).getWellKnownDocument('anyurl', 'configId').subscribe({
147-
error: (err: any) => {
147+
error: (err: unknown) => {
148148
expect(err).toBeTruthy();
149149
},
150150
});

projects/angular-auth-oidc-client/src/lib/config/validation/config-validation.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ConfigValidationService {
2121

2222
private validateConfigsInternal(
2323
passedConfigs: OpenIdConfiguration[],
24-
allRulesToUse: any[]
24+
allRulesToUse: ((passedConfig: OpenIdConfiguration[]) => RuleValidationResult)[]
2525
): boolean {
2626
if (passedConfigs.length === 0) {
2727
return false;
@@ -47,7 +47,7 @@ export class ConfigValidationService {
4747

4848
private validateConfigInternal(
4949
passedConfig: OpenIdConfiguration,
50-
allRulesToUse: any[]
50+
allRulesToUse: ((passedConfig: OpenIdConfiguration) => RuleValidationResult)[]
5151
): boolean {
5252
const allValidationResults = allRulesToUse.map((rule) =>
5353
rule(passedConfig)

projects/angular-auth-oidc-client/src/lib/flows/callback-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface CallbackContext {
1010
isRenewProcess: boolean;
1111
jwtKeys: JwtKeys | null;
1212
validationResult: StateValidationResult | null;
13-
existingIdToken: any;
13+
existingIdToken: string | null;
1414
}
1515

1616
export interface AuthResult {

projects/angular-auth-oidc-client/src/lib/flows/callback-handling/code-flow-callback-handler.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ describe('CodeFlowCallbackHandlerService', () => {
5252
'getUrlParameter'
5353
).and.returnValue('params');
5454

55-
getUrlParameterSpy.withArgs('any-url', 'state').and.returnValue('');
55+
getUrlParameterSpy.withArgs('test-url', 'state').and.returnValue('');
5656

57-
service.codeFlowCallback('any-url', { configId: 'configId1' }).subscribe({
57+
service.codeFlowCallback('test-url', { configId: 'configId1' }).subscribe({
5858
error: (err) => {
5959
expect(err).toBeTruthy();
6060
},
@@ -67,9 +67,9 @@ describe('CodeFlowCallbackHandlerService', () => {
6767
'getUrlParameter'
6868
).and.returnValue('params');
6969

70-
getUrlParameterSpy.withArgs('any-url', 'code').and.returnValue('');
70+
getUrlParameterSpy.withArgs('test-url', 'code').and.returnValue('');
7171

72-
service.codeFlowCallback('any-url', { configId: 'configId1' }).subscribe({
72+
service.codeFlowCallback('test-url', { configId: 'configId1' }).subscribe({
7373
error: (err) => {
7474
expect(err).toBeTruthy();
7575
},
@@ -92,7 +92,7 @@ describe('CodeFlowCallbackHandlerService', () => {
9292
} as CallbackContext;
9393

9494
service
95-
.codeFlowCallback('any-url', { configId: 'configId1' })
95+
.codeFlowCallback('test-url', { configId: 'configId1' })
9696
.subscribe((callbackContext) => {
9797
expect(callbackContext).toEqual(expectedCallbackContext);
9898
});

0 commit comments

Comments
 (0)