소스 검색

Chore: Add more explicit typing (#16594)

Andrej Ocenas 6 년 전
부모
커밋
6eb8b29d70
2개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      public/app/features/datasources/utils/passwordHandlers.test.ts
  2. 8 2
      public/app/features/datasources/utils/passwordHandlers.ts

+ 1 - 1
public/app/features/datasources/utils/passwordHandlers.test.ts

@@ -2,7 +2,7 @@ import { createResetHandler, PasswordFieldEnum, Ctrl } from './passwordHandlers'
 
 describe('createResetHandler', () => {
   Object.keys(PasswordFieldEnum).forEach(fieldKey => {
-    const field = PasswordFieldEnum[fieldKey];
+    const field: any = PasswordFieldEnum[fieldKey as any];
 
     it(`should reset existing ${field} field`, () => {
       const event: any = {

+ 8 - 2
public/app/features/datasources/utils/passwordHandlers.ts

@@ -15,8 +15,14 @@ export enum PasswordFieldEnum {
  */
 export type Ctrl = {
   current: {
-    secureJsonFields: {};
-    secureJsonData?: {};
+    secureJsonFields: {
+      [key: string]: boolean;
+    };
+    secureJsonData?: {
+      [key: string]: string;
+    };
+    password?: string;
+    basicAuthPassword?: string;
   };
 };