diff --git a/typings/mysql/lib/parsers/index.d.ts b/typings/mysql/lib/parsers/index.d.ts index 7f1d48e943..734c4d924b 100644 --- a/typings/mysql/lib/parsers/index.d.ts +++ b/typings/mysql/lib/parsers/index.d.ts @@ -1,3 +1,18 @@ import { setMaxParserCache, clearParserCache } from './ParserCache.js'; +import { + TypeCast, + Field as TypeCastField, + Geometry as TypeCastGeometry, + Next as TypeCastNext, + Type as TypeCastType, +} from './typeCast.js'; -export { setMaxParserCache, clearParserCache }; +export { + setMaxParserCache, + clearParserCache, + TypeCast, + TypeCastField, + TypeCastGeometry, + TypeCastNext, + TypeCastType, +}; diff --git a/typings/mysql/lib/parsers/typeCast.d.ts b/typings/mysql/lib/parsers/typeCast.d.ts index 0311bdb089..65bfaa8949 100644 --- a/typings/mysql/lib/parsers/typeCast.d.ts +++ b/typings/mysql/lib/parsers/typeCast.d.ts @@ -1,9 +1,9 @@ -type Geometry = { +export type Geometry = { x: number; y: number; }; -type Type = { +export type Type = { type: | 'DECIMAL' | 'TINY' @@ -38,7 +38,7 @@ type Type = { | 'GEOMETRY'; }; -type Field = Type & { +export type Field = Type & { length: number; db: string; table: string; @@ -48,6 +48,6 @@ type Field = Type & { geometry: () => Geometry | Geometry[] | null; }; -type Next = () => void; +export type Next = () => void; export type TypeCast = ((field: Field, next: Next) => any) | boolean; diff --git a/typings/mysql/lib/protocol/packets/Field.d.ts b/typings/mysql/lib/protocol/packets/Field.d.ts index dc9967b6cc..a8c1690622 100644 --- a/typings/mysql/lib/protocol/packets/Field.d.ts +++ b/typings/mysql/lib/protocol/packets/Field.d.ts @@ -1,15 +1,10 @@ -declare interface Field { - constructor: { - name: 'Field'; - }; - db: string; - table: string; - name: string; - type: string; - length: number; - string: () => any; - buffer: () => any; - geometry: () => any; -} +// TODO (major version): remove workaround for `Field` compatibility. +import { TypeCastField } from '../../../lib/parsers/index.js'; + +/** + * @deprecated + * `Field` is deprecated and might be removed in the future major release. Please use `TypeCastField` type instead. + */ +declare interface Field extends TypeCastField {} export { Field };