Skip to content

Commit

Permalink
feat(data-set)!: remove type coercion (#388)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Type coercion is no longer supported.

This has been deprecated for a long time now.
  • Loading branch information
Thomaash authored Aug 2, 2020
1 parent 8b8c252 commit 2426418
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 411 deletions.
2 changes: 0 additions & 2 deletions __snapshots__/package.test.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ exports['Package Exported files 1'] = {
" LICENSE-APACHE-2.0",
" LICENSE-MIT",
" README.md",
" declarations/convert.d.ts",
" declarations/convert.d.ts.map",
" declarations/data-interface.d.ts",
" declarations/data-interface.d.ts.map",
" declarations/data-pipe.d.ts",
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
}
},
"peerDependencies": {
"moment": "^2.24.0",
"vis-util": "^4.0.0",
"uuid": "^7.0.0 || ^8.0.0"
},
Expand Down Expand Up @@ -101,7 +100,6 @@
"husky": "4.2.5",
"lint-staged": "10.2.11",
"mocha": "8.1.0",
"moment": "2.27.0",
"nyc": "15.1.0",
"opencollective": "1.0.3",
"postcss-assets": "5.0.0",
Expand Down
1 change: 0 additions & 1 deletion rollup.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default generateRollupConfiguration({
globals: {
uuid: "uuidv4",
"vis-util": "vis",
moment: "moment",
},
header: { name: "vis-data" },
libraryFilename: "vis-data",
Expand Down
186 changes: 0 additions & 186 deletions src/convert.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/data-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@ import { DataStream } from "./data-stream";

type ValueOf<T> = T[keyof T];

/**
* Available types for enforcing property types.
*
* | Name | Description | Examples |
* |---------|-----------------------------------------|-----------------------------------------------------------|
* | Boolean | A JavaScript Boolean | `true`, `false` |
* | Number | A JavaScript Number | `32`, `2.4` |
* | String | A JavaScript String | `"hello world"`, `"2013-06-28"` |
* | Date | A JavaScript Date object | `new Date()`, `new Date(2013, 5, 28)`, `new Date(13723 |
* | Moment | A Moment object, created with moment.js | `moment()`, `moment('2013-06-28')` |
* | ISODate | A string containing an ISO Date | `new Date().toISOString()`, `"2013-06-27T22:00:00.000Z"` |
* | ASPDate | A string containing an ASP Date | `"/Date(1372370400000)/"`, `"/Date(1198908717056-0700)/"` |
*/
export type Types =
| "boolean"
| "Boolean"
| "number"
| "Number"
| "string"
| "String"
| "Date"
| "ISODate"
| "ASPDate"
| "Moment";

/** Valid id type. */
export type Id = number | string;
/** Nullable id type. */
Expand Down Expand Up @@ -205,8 +180,6 @@ export type EventName = keyof EventPayloads<never, "">;
/** Available event names and '*' to listen for all. */
export type EventNameWithAny = keyof EventPayloadsWithAny<never, "">;

/** Maps property name to their types. */
export type TypeMap = Record<string, Types>;
/**
* Data interface order parameter.
* - A string value determines which property will be used for sorting (using < and > operators for numeric comparison).
Expand Down Expand Up @@ -235,13 +208,6 @@ export interface DataInterfaceGetOptionsBase<Item> {
filter?: (item: Item) => boolean;
/** Order the items by a field name or custom sort function. */
order?: DataInterfaceOrder<Item>;
/**
* An object containing field names as key, and data types as value. By default, the type of the properties of an item are left unchanged. When a field type is specified, this field in the items will be converted to the specified type. This can be used for example to convert ISO strings containing a date to a JavaScript Date object, or convert strings to numbers or vice versa.
*
* @remarks
* **Warning**: There is no TypeScript support for this.
*/
type?: TypeMap;
}

/**
Expand Down Expand Up @@ -291,8 +257,6 @@ export interface DataInterfaceGetIdsOptions<Item> {
filter?: (item: Item) => boolean;
/** Order the items by a field name or custom sort function. */
order?: DataInterfaceOrder<Item>;
/** An object containing field names as key, and data types as value. By default, the type of the properties of an item are left unchanged. When a field type is specified, this field in the items will be converted to the specified type. This can be used for example to convert ISO strings containing a date to a JavaScript Date object, or convert strings to numbers or vice versa. */
type?: TypeMap;
}

/**
Expand All @@ -307,8 +271,6 @@ export interface DataInterfaceForEachOptions<Item> {
filter?: (item: Item) => boolean;
/** Order the items by a field name or custom sort function. */
order?: DataInterfaceOrder<Item>;
/** An object containing field names as key, and data types as value. By default, the type of the properties of an item are left unchanged. When a field type is specified, this field in the items will be converted to the specified type. This can be used for example to convert ISO strings containing a date to a JavaScript Date object, or convert strings to numbers or vice versa. */
type?: TypeMap;
}

/**
Expand All @@ -324,8 +286,6 @@ export interface DataInterfaceMapOptions<Original, Mapped> {
filter?: (item: Original) => boolean;
/** Order the items by a field name or custom sort function. */
order?: DataInterfaceOrder<Mapped>;
/** An object containing field names as key, and data types as value. By default, the type of the properties of an item are left unchanged. When a field type is specified, this field in the items will be converted to the specified type. This can be used for example to convert ISO strings containing a date to a JavaScript Date object, or convert strings to numbers or vice versa. */
type?: TypeMap;
}

/**
Expand Down
Loading

0 comments on commit 2426418

Please sign in to comment.