Skip to content

feat(cdk/table): Make CdkTableDataSourceInput an exported type  #24518

@nuwang91

Description

@nuwang91

Feature Description

Problem

Currently the CdkTableDataSourceInput<T> is not an exported type in cdk/table/table.ts. Therefore consumers of the cdk table might have to duplicate the type definition in their code base when building their components based on cdk table.

Proposed Solution

export the type so that consumer of the cdk table could make use of this type when basing/wrapping their components based on cdk table. #

type CdkTableDataSourceInput<T> = readonly T[] | DataSource<T> | Observable<readonly T[]>;

This behavior is similar to that of TrackByFunction<T>

Example Wrapper

// Unnecessary code duplication
type CdkTableDataSourceInput<T> =
  | readonly T[]
  | DataSource<T>
  | Observable<readonly T[]>;

@Component({
  selector: 'wrapper-table',
  ...
})
export class WrapperTableComponent<T> {
  @Input()
  dataSource: CdkTableDataSourceInput<T>;

  @Input()
  trackBy: TrackByFunction<T>;

  ...

Use Case

No response

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/tablefeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions