[Cloud Security] use as const for const dicts for TS to infer correct types (#180566)

## Summary

using `as const` on exported const objects to allow TS infer the
narrowest possible types

Follow up on the CR comment 
- https://github.com/elastic/kibana/pull/179031#discussion_r1549592678
This commit is contained in:
Maxim Kholod 2024-04-12 18:58:44 +02:00 committed by GitHub
parent d719c89190
commit 73d853300f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View file

@ -44,7 +44,7 @@ export type SetupFormat = typeof AWS_SETUP_FORMAT.CLOUD_FORMATION | typeof AWS_S
export const AWS_SETUP_FORMAT = {
CLOUD_FORMATION: 'cloud_formation',
MANUAL: 'manual',
};
} as const;
export const AWS_CREDENTIALS_TYPE = {
ASSUME_ROLE: 'assume_role',
@ -53,6 +53,7 @@ export const AWS_CREDENTIALS_TYPE = {
SHARED_CREDENTIALS: 'shared_credentials',
CLOUD_FORMATION: 'cloud_formation',
} as const;
export const AWSSetupInfoContent = ({ info }: AWSSetupInfoContentProps) => {
return (
<>

View file

@ -45,7 +45,7 @@ export type SetupFormat = typeof AZURE_SETUP_FORMAT.ARM_TEMPLATE | typeof AZURE_
export const AZURE_SETUP_FORMAT = {
ARM_TEMPLATE: 'arm_template',
MANUAL: 'manual',
};
} as const;
export const AZURE_CREDENTIALS_TYPE = {
ARM_TEMPLATE: 'arm_template',

View file

@ -46,15 +46,16 @@ import {
export const GCP_SETUP_ACCESS = {
CLOUD_SHELL: 'google_cloud_shell',
MANUAL: 'manual',
};
} as const;
export const GCP_CREDENTIALS_TYPE = {
CREDENTIALS_FILE: 'credentials-file',
CREDENTIALS_JSON: 'credentials-json',
CREDENTIALS_NONE: 'credentials-none',
};
} as const;
type SetupFormatGCP = typeof GCP_SETUP_ACCESS.CLOUD_SHELL | typeof GCP_SETUP_ACCESS.MANUAL;
export const GCPSetupInfoContent = () => (
<>
<EuiHorizontalRule margin="xl" />