mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Use MetaTableData more
Summary: Add more method overrides to MetaTableData for extra type safety. Use MetaTableData, MetaRowRecord, and getMetaTable in more places. Test Plan: Mostly it just has to compile. Tested manually that types are being checked more strictly now, e.g. by adding a typo to property names. Some type casting has also been removed. Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3168
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
*/
|
||||
|
||||
import {DocComm} from 'app/client/components/DocComm';
|
||||
import {TableData} from 'app/client/models/TableData';
|
||||
import {MetaTableData, TableData} from 'app/client/models/TableData';
|
||||
import {ApplyUAOptions, ApplyUAResult} from 'app/common/ActiveDocAPI';
|
||||
import {CellValue, TableDataAction, UserAction} from 'app/common/DocActions';
|
||||
import {DocData as BaseDocData} from 'app/common/DocData';
|
||||
import {SchemaTypes} from 'app/common/schema';
|
||||
import {ColTypeMap} from 'app/common/TableData';
|
||||
import * as bluebird from 'bluebird';
|
||||
import {Emitter} from 'grainjs';
|
||||
@@ -51,6 +52,11 @@ export class DocData extends BaseDocData {
|
||||
return super.getTable(tableId) as TableData;
|
||||
}
|
||||
|
||||
// Version of inherited getMetaTable() which returns the enhanced TableData type.
|
||||
public getMetaTable<TableId extends keyof SchemaTypes>(tableId: TableId): MetaTableData<TableId> {
|
||||
return super.getMetaTable(tableId) as any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds up to n most likely target columns for the given values in the document.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user