Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type errors in Multiple Data Sources #3026

Open
tmarkley opened this issue Dec 4, 2022 · 7 comments
Open

Fix type errors in Multiple Data Sources #3026

tmarkley opened this issue Dec 4, 2022 · 7 comments
Assignees
Labels
good first issue Good for newcomers help wanted Community development is encouraged multiple datasource multiple datasource project technical debt If not paid, jeapardizes long-term success and maintainability of the repository. typescript

Comments

@tmarkley
Copy link
Contributor

tmarkley commented Dec 4, 2022

Task for #1660

PR: #2334

Code owners and PR reviewers, can you help address this?
@kristenTian @AMoo-Miki @zengyan-amazon @zhongnansu @noCharger

$ tsc --noEmit
...

src/plugins/data_source/server/plugin.ts:88:44 - error TS2554: Expected 1 arguments, but got 2.

88         return new LoggingAuditor(request, this.logger.get('audit'));
                                              ~~~~~~~~~~~~~~~~~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:148:13 - error TS2339: Property 'endpoint' does not exist on type 'unknown'.

148     const { endpoint, auth } = attributes;
                ~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:148:23 - error TS2339: Property 'auth' does not exist on type 'unknown'.

148     const { endpoint, auth } = attributes;
                          ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:181:13 - error TS2339: Property 'auth' does not exist on type 'Partial<T>'.

181     const { auth, endpoint } = attributes;
                ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:181:19 - error TS2339: Property 'endpoint' does not exist on type 'Partial<T>'.

181     const { auth, endpoint } = attributes;
                      ~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:227:13 - error TS2339: Property 'title' does not exist on type 'unknown'.

227     const { title, endpoint, auth } = attributes;
                ~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:227:20 - error TS2339: Property 'endpoint' does not exist on type 'unknown'.

227     const { title, endpoint, auth } = attributes;
                       ~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:227:30 - error TS2339: Property 'auth' does not exist on type 'unknown'.

227     const { title, endpoint, auth } = attributes;
                                 ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:246:13 - error TS2339: Property 'type' does not exist on type 'unknown'.

246     const { type, credentials } = auth;
                ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:246:19 - error TS2339: Property 'credentials' does not exist on type 'unknown'.

246     const { type, credentials } = auth;
                      ~~~~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:308:13 - error TS2339: Property 'endpoint' does not exist on type '{}'.

308     const { endpoint, auth } = attributes;
                ~~~~~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:308:23 - error TS2339: Property 'auth' does not exist on type '{}'.

308     const { endpoint, auth } = attributes;
                          ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:366:85 - error TS2304: Cannot find name 'type'.

366         throw SavedObjectsErrorHelpers.createBadRequestError(`Invalid auth type: '${type}'`);
                                                                                        ~~~~

src/plugins/data_source/server/saved_objects/data_source_saved_objects_client_wrapper.ts:372:7 - error TS2339: Property 'credentials' does not exist on type 'unknown'.

372       credentials: { username, password },
          ~~~~~~~~~~~

src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx:59:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<CreateDataSourceProps, CreateDataSourceState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

59   public readonly context!: DataSourceManagementContextValue;
                     ~~~~~~~

src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx:67:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<EditDataSourceProps, EditDataSourceState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

67   public readonly context!: DataSourceManagementContextValue;
                     ~~~~~~~

src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx:234:51 - error TS2554: Expected 1 arguments, but got 2.

234         await this.props.handleSubmit(formValues, false);
                                                      ~~~~~

src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx:283:55 - error TS2554: Expected 1 arguments, but got 2.

283       await this.props.handleSubmit(updateAttributes, true);
                                                          ~~~~

src/plugins/data_source_management/public/plugin.ts:48:39 - error TS2345: Argument of type 'StartServicesAccessor<object, unknown>' is not assignable to parameter of type 'StartServicesAccessor<DataSourceManagementStartDependencies, unknown>'.
  Property 'data' is missing in type '{}' but required in type 'DataSourceManagementStartDependencies'.

48         return mountManagementSection(core.getStartServices, params);
                                         ~~~~~~~~~~~~~~~~~~~~~

  src/plugins/data_source_management/public/management_app/mount_management_section.tsx:23:3
    23   data: DataPublicPluginStart;
         ~~~~
    'data' is declared here.

src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_data_source/components/header/header.tsx:166:15 - error TS2322: Type 'DataSourceTableItem[]' is not assignable to type 'never[]'.
  Type 'DataSourceTableItem' is not assignable to type 'never'.

166               options={dataSources}
                  ~~~~~~~

  node_modules/@elastic/eui/oui.d.ts:29190:6
    29190      options: Array<EuiSelectableOption<T>>;
               ~~~~~~~
    The expected type comes from property 'options' which is declared here on type 'IntrinsicAttributes & (IntrinsicClassAttributes<EuiSelectable<DataSourceTableItem>> & ((Pick<...> & ... 1 more ... & Partial<...>) | (Pick<...> & ... 1 more ... & Partial<...>)))'

src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx:117:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<StepIndexPatternProps, StepIndexPatternState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

117   public readonly context!: IndexPatternManagmentContextValue;
                      ~~~~~~~

src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx:85:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<StepTimeFieldProps, StepTimeFieldState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

85   public readonly context!: IndexPatternManagmentContextValue;
                     ~~~~~~~

src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx:89:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<RouteComponentProps<{}, StaticContext, unknown>, CreateIndexPatternWizardState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

89   public readonly context!: IndexPatternManagmentContextValue;
                     ~~~~~~~

src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts:288:7 - error TS2322: Type '{ ignoreUnavailable: true; expand_wildcards: "all" | "open"; index: string; body: { size: number; aggs: { indices: { terms: { field: string; size: number; }; }; }; }; }' is not assignable to type 'ISearchRequestParams<Record<string, any>>'.
  Object literal may only specify known properties, but 'ignoreUnavailable' does not exist in type 'ISearchRequestParams<Record<string, any>>'. Did you mean to write 'ignore_unavailable'?

288       ignoreUnavailable: true,
          ~~~~~~~~~~~~~~~~~~~~~~~

  src/plugins/data/common/search/types.ts:88:3
    88   params?: Params;
         ~~~~~~
    The expected type comes from property 'params' which is declared here on type 'IOpenSearchSearchRequest'

src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx:76:19 - error TS2612: Property 'context' will overwrite the base property in 'Component<TestScriptProps, TestScriptState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

76   public readonly context!: IndexPatternManagmentContextValue;
                     ~~~~~~~

src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx:153:19 - error TS2612: Property 'context' will overwrite the base property in 'PureComponent<FieldEdiorProps, FieldEditorState, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

153   public readonly context!: IndexPatternManagmentContextValue;
                      ~~~~~~~

src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx:35:33 - error TS2306: File '/workspaces/OpenSearch-Dashboards/node_modules/@elastic/eui/lib/test/index.d.ts' is not a module.

35 import { findTestSubject } from '@elastic/eui/lib/test';
                                   ~~~~~~~~~~~~~~~~~~~~~~~

src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx:116:10 - error TS6133: 'isColumnDataLoaded' is declared but its value is never read.

116   const [isColumnDataLoaded, setIsColumnDataLoaded] = useState(false);
             ~~~~~~~~~~~~~~~~~~

src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx:291:11 - error TS2322: Type '({ sortable: boolean; 'data-test-subj': string; description?: string | undefined; children?: ReactNode; name: ReactNode; 'aria-label'?: string | undefined; 'aria-describedby'?: string | undefined; ... 270 more ...; valign?: "baseline" | ... 3 more ... | undefined; } | { ...; })[]' is not assignable to type 'EuiBasicTableColumn<IndexPatternTableItem>[]'.
  Type '{ sortable: boolean; 'data-test-subj': string; description?: string | undefined; children?: ReactNode; name: ReactNode; 'aria-label'?: string | undefined; 'aria-describedby'?: string | undefined; ... 270 more ...; valign?: "baseline" | ... 3 more ... | undefined; } | { ...; }' is not assignable to type 'EuiBasicTableColumn<IndexPatternTableItem>'.
    Type '{ sortable: boolean; 'data-test-subj': string; description?: string | undefined; children?: React.ReactNode; name: React.ReactNode; 'aria-label'?: string | undefined; 'aria-describedby'?: string | undefined; ... 270 more ...; valign?: "baseline" | ... 3 more ... | undefined; }' is not assignable to type 'EuiBasicTableColumn<IndexPatternTableItem>'.
      Type '{ sortable: boolean; 'data-test-subj': string; description?: string | undefined; children?: React.ReactNode; name: React.ReactNode; 'aria-label'?: string | undefined; 'aria-describedby'?: string | undefined; ... 270 more ...; valign?: "baseline" | ... 3 more ... | undefined; }' is not assignable to type 'EuiTableFieldDataColumnType<IndexPatternTableItem>'.
        Types of property 'mobileOptions' are incompatible.
          Type '{ show?: boolean | undefined; only?: boolean | undefined; render?: ((item: IndexPatternTableRecord) => ReactNode) | undefined; header?: boolean | undefined; } | undefined' is not assignable to type '{ show?: boolean | undefined; only?: boolean | undefined; render?: ((item: IndexPatternTableItem) => ReactNode) | undefined; header?: boolean | undefined; } | undefined'.
            Type '{ show?: boolean | undefined; only?: boolean | undefined; render?: ((item: IndexPatternTableRecord) => ReactNode) | undefined; header?: boolean | undefined; }' is not assignable to type '{ show?: boolean | undefined; only?: boolean | undefined; render?: ((item: IndexPatternTableItem) => ReactNode) | undefined; header?: boolean | undefined; }'.
              Types of property 'render' are incompatible.
                Type '((item: IndexPatternTableRecord) => ReactNode) | undefined' is not assignable to type '((item: IndexPatternTableItem) => ReactNode) | undefined'.
                  Type '(item: IndexPatternTableRecord) => ReactNode' is not assignable to type '(item: IndexPatternTableItem) => ReactNode'.
                    Types of parameters 'item' and 'item' are incompatible.
                      Property 'type' is missing in type 'IndexPatternTableItem' but required in type 'IndexPatternTableRecord'.

291           columns={columns}
              ~~~~~~~

  src/plugins/index_pattern_management/public/types.ts:77:3
    77   type: string;
         ~~~~
    'type' is declared here.
  node_modules/@elastic/eui/oui.d.ts:14456:6
    14456      columns: Array<EuiBasicTableColumn<T>>;
               ~~~~~~~
    The expected type comes from property 'columns' which is declared here on type 'IntrinsicAttributes & (IntrinsicClassAttributes<EuiInMemoryTable<IndexPatternTableItem>> & ((Pick<...> & ... 1 more ... & Partial<...>) | (Pick<...> & ... 1 more ... & Partial<...>)))'

src/plugins/index_pattern_management/public/components/test_utils.tsx:46:19 - error TS2322: Type 'Props' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<any, any, any>> & Readonly<any> & Readonly<{ children?: ReactNode; }>'.
  Type 'Props' is not assignable to type 'IntrinsicAttributes'.

46   return shallow(<MyComponent {...props} />, {
                     ~~~~~~~~~~~

  src/plugins/index_pattern_management/public/components/test_utils.tsx:37:44
    37 export function createComponentWithContext<Props = Record<string, any>>(
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends JSX.IntrinsicAttributes` constraint.
  src/plugins/index_pattern_management/public/components/test_utils.tsx:37:44
    37 export function createComponentWithContext<Props = Record<string, any>>(
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends JSX.IntrinsicAttributes & JSX.IntrinsicClassAttributes<React.Component<any, any, any>> & Readonly<any> & Readonly<{ children?: React.ReactNode; }>` constraint.

src/plugins/index_pattern_management/public/mocks.ts:42:64 - error TS2741: Property 'columns' is missing in type '{ creation: any; list: any; fieldFormatEditors: any; environment: { update: jest.Mock<any, any>; }; }' but required in type '{ creation: { addCreationConfig: (Config: typeof IndexPatternCreationConfig) => void; }; list: { addListConfig: (Config: typeof IndexPatternListConfig) => void; }; fieldFormatEditors: { ...; }; environment: { ...; }; columns: IndexPatternTableColumnServiceSetup; }'.

 42 const createSetupContract = (): IndexPatternManagementSetup => ({
                                                                   ~~
 43   creation: {
    ~~~~~~~~~~~~~
... 
 55   },
    ~~~~
 56 });
    ~~

  src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts:104:7
    104       columns: this.columnService.setup(),
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'columns' is declared here.

src/plugins/index_pattern_management/public/mocks.ts:58:64 - error TS2741: Property 'columns' is missing in type '{ creation: any; list: any; fieldFormatEditors: any; }' but required in type '{ creation: { getType: (key: string | undefined) => IndexPatternCreationConfig; getIndexPatternCreationOptions: (urlHandler: UrlHandler) => Promise<...>; }; list: { ...; }; fieldFormatEditors: { ...; }; columns: IndexPatternTableColumnServiceStart; }'.

 58 const createStartContract = (): IndexPatternManagementStart => ({
                                                                   ~~
 59   creation: {
    ~~~~~~~~~~~~~
... 
 71   } as any,
    ~~~~~~~~~~~
 72 });
    ~~

  src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts:113:7
    113       columns: this.columnService.start(),
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'columns' is declared here.

src/plugins/index_pattern_management/server/routes/resolve_index.ts:32:19 - error TS6133: 'LegacyAPICaller' is declared but its value is never read.

32 import { IRouter, LegacyAPICaller } from 'src/core/server';
                     ~~~~~~~~~~~~~~~



@kavilla kavilla added the multiple datasource multiple datasource project label Dec 6, 2022
@joshuarrrr joshuarrrr added good first issue Good for newcomers help wanted Community development is encouraged technical debt If not paid, jeapardizes long-term success and maintainability of the repository. typescript and removed untriaged labels Dec 6, 2022
@joshuarrrr joshuarrrr added v2.8.0 and removed v2.7.0 labels Apr 12, 2023
@zhongnansu zhongnansu removed the v2.8.0 label May 24, 2023
@CMDWillYang
Copy link
Contributor

@joshuarrrr I'd love to look at this.

CMDWillYang added a commit to CMDWillYang/OpenSearch-Dashboards that referenced this issue Nov 28, 2023
ananzh added a commit to CMDWillYang/OpenSearch-Dashboards that referenced this issue Dec 14, 2023
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
@bandinib-amzn
Copy link
Member

There is type error that got introduced after new changes.

Property 'setup' in type 'DataSourceManagementPlugin' is not assignable to the same property in base type 'Plugin<DataSourceManagementPluginSetup, DataSourceManagementPluginStart, DataSourceManagementSetupDependencies, object>'. 

@xinruiba Are you going to work on this?

@xinruiba
Copy link
Member

xinruiba commented Mar 21, 2024

There is type error that got introduced after new changes.

Property 'setup' in type 'DataSourceManagementPlugin' is not assignable to the same property in base type 'Plugin<DataSourceManagementPluginSetup, DataSourceManagementPluginStart, DataSourceManagementSetupDependencies, object>'. 

@xinruiba Are you going to work on this?

Yup, happy to work on it.

@bandinib-amzn
Copy link
Member

Targeting to fix these type errors in 2.15.

@BionIT
Copy link
Collaborator

BionIT commented Jun 3, 2024

@bandinib-amzn @xinruiba Do we want to target this for 2.15 or 2.16?

@bandinib-amzn
Copy link
Member

@BionIT We won't be targeting this for 2.15.

@BionIT
Copy link
Collaborator

BionIT commented Jun 3, 2024

Got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Community development is encouraged multiple datasource multiple datasource project technical debt If not paid, jeapardizes long-term success and maintainability of the repository. typescript
Projects
None yet
Development

No branches or pull requests

8 participants