stricter typescript
This commit is contained in:
parent
120bcb8e1e
commit
153c5725aa
|
@ -29,10 +29,10 @@ export class KVSecretVew extends Component<KVSecretViewProps, unknown> {
|
|||
} else {
|
||||
return (
|
||||
<>
|
||||
{Array.from(secretsMap).map((data: [string, string]) => (
|
||||
{Array.from(secretsMap).map((data: [string, unknown]) => (
|
||||
<Grid size={GridSizes.NORMAL}>
|
||||
<CopyableInputBox text={data[0]} copyable />
|
||||
<CopyableInputBox text={data[1]} copyable />
|
||||
<CopyableInputBox text={data[1] as string} copyable />
|
||||
</Grid>
|
||||
))}
|
||||
</>
|
||||
|
|
|
@ -41,7 +41,7 @@ export class KeyValueEditorSettings extends Component<DefaultPageProps> {
|
|||
type="number"
|
||||
value={this.props.settings.kvEditorIndent}
|
||||
onChange={() => {
|
||||
const value = this.indentInputRef.current.value;
|
||||
const value = this.indentInputRef.current?.value;
|
||||
const indent = parseInt(value);
|
||||
this.props.settings.kvEditorIndent = indent;
|
||||
settingsSavedNotification();
|
||||
|
|
|
@ -46,6 +46,7 @@ type UnsealPageState = {
|
|||
mode: string;
|
||||
keys_submitted: number;
|
||||
keys_needed: number;
|
||||
timer: number;
|
||||
};
|
||||
|
||||
export class Unseal extends Component<DefaultPageProps, UnsealPageState> {
|
||||
|
@ -55,11 +56,10 @@ export class Unseal extends Component<DefaultPageProps, UnsealPageState> {
|
|||
mode: UnsealInputModes.FORM_INPUT,
|
||||
keys_submitted: 0,
|
||||
keys_needed: 0,
|
||||
timer: 0,
|
||||
};
|
||||
}
|
||||
|
||||
timer: number;
|
||||
|
||||
async submitKey(key: string): Promise<void> {
|
||||
try {
|
||||
await this.props.api.submitUnsealKey(key);
|
||||
|
@ -83,14 +83,15 @@ export class Unseal extends Component<DefaultPageProps, UnsealPageState> {
|
|||
}
|
||||
|
||||
componentWillUnmount(): void {
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.state.timer);
|
||||
}
|
||||
|
||||
componentDidMount(): void {
|
||||
this.updateStateWithSealStatus();
|
||||
this.timer = setInterval(() => {
|
||||
const timer = setInterval(() => {
|
||||
this.updateStateWithSealStatus();
|
||||
}, 500) as unknown as number;
|
||||
this.setState({timer: timer});
|
||||
}
|
||||
|
||||
render(): JSX.Element {
|
||||
|
|
|
@ -14,10 +14,11 @@ export const sortedObjectMap = (obj: Record<string, unknown>): Map<string, unkno
|
|||
export function getKeyByObjectPropertyValue(
|
||||
map: Record<string, unknown>,
|
||||
searchValue: unknown,
|
||||
): string {
|
||||
): string | null {
|
||||
for (const key of getObjectKeys(map)) {
|
||||
if (map[key] === searchValue) return key;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function verifyJSONString(str: string): boolean {
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
"module": "es6",
|
||||
"target": "es2019",
|
||||
"strictBindCallApply": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitThis": true,
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact",
|
||||
|
|
Loading…
Reference in a new issue