不要怂,就是干,撸起袖子干!

Commit 6b82bee6 by Simon Schick Committed by Erik Seliger

fix(typescript): add missing data types (#10607)

Fixes #10606
1 parent d1c19582
......@@ -64,8 +64,6 @@ export interface AbstractDataType {
/**
* A variable length string. Default length 255
*
* Available properties: `BINARY`
*/
export const STRING: StringDataTypeConstructor;
......@@ -89,9 +87,6 @@ export interface StringDataTypeOptions {
/**
* A fixed length string. Default length 255
*
* Available properties: `BINARY`
*
*/
export const CHAR: CharDataTypeConstructor;
......@@ -145,20 +140,61 @@ export interface NumberDataType extends AbstractDataType {
validate(value: unknown): boolean;
}
export interface NumberDataTypeOptions {
export interface IntegerDataTypeOptions {
length?: number;
zerofill?: boolean;
unsigned?: boolean;
}
export interface NumberDataTypeOptions extends IntegerDataTypeOptions {
decimals?: number;
precision?: number;
scale?: number;
unsigned?: boolean;
}
/**
* A 8 bit integer.
*/
export const TINYINT: TinyIntegerDataTypeConstructor;
interface TinyIntegerDataTypeConstructor extends NumberDataTypeConstructor {
new (options?: IntegerDataTypeOptions): TinyIntegerDataType;
(options?: IntegerDataTypeOptions): TinyIntegerDataType;
}
export interface TinyIntegerDataType extends NumberDataType {
options: IntegerDataTypeOptions;
}
/**
* A 16 bit integer.
*/
export const SMALLINT: SmallIntegerDataTypeConstructor;
interface SmallIntegerDataTypeConstructor extends NumberDataTypeConstructor {
new (options?: IntegerDataTypeOptions): SmallIntegerDataType;
(options?: IntegerDataTypeOptions): SmallIntegerDataType;
}
export interface SmallIntegerDataType extends NumberDataType {
options: IntegerDataTypeOptions;
}
/**
* A 24 bit integer.
*/
export const MEDIUMINT: MediumIntegerDataTypeConstructor;
interface MediumIntegerDataTypeConstructor extends NumberDataTypeConstructor {
new (options?: IntegerDataTypeOptions): MediumIntegerDataType;
(options?: IntegerDataTypeOptions): MediumIntegerDataType;
}
export interface MediumIntegerDataType extends NumberDataType {
options: IntegerDataTypeOptions;
}
/**
* A 32 bit integer.
*
* Available properties: `UNSIGNED`, `ZEROFILL`
*
*/
export const INTEGER: IntegerDataTypeConstructor;
......@@ -171,10 +207,6 @@ export interface IntegerDataType extends NumberDataType {
options: NumberDataTypeOptions;
}
export interface IntegerDataTypeOptions {
length?: number;
}
/**
* A 64 bit integer.
*
......@@ -184,16 +216,12 @@ export interface IntegerDataTypeOptions {
export const BIGINT: BigIntDataTypeConstructor;
interface BigIntDataTypeConstructor extends NumberDataTypeConstructor {
new (options?: BigIntDataTypeOptions): BigIntDataType;
(options?: BigIntDataTypeOptions): BigIntDataType;
new (options?: IntegerDataTypeOptions): BigIntDataType;
(options?: IntegerDataTypeOptions): BigIntDataType;
}
export interface BigIntDataType extends NumberDataType {
options: BigIntDataTypeOptions;
}
export interface BigIntDataTypeOptions {
length?: number;
options: IntegerDataTypeOptions;
}
/**
......@@ -576,6 +604,5 @@ export const MACADDR: AbstractDataTypeConstructor;
*/
export const CITEXT: AbstractDataTypeConstructor;
// umzug compatibility
export type DataTypeAbstract = AbstractDataTypeConstructor;
import { INTEGER, IntegerDataType, TINYINT } from 'sequelize';
import { SmallIntegerDataType, SMALLINT, MEDIUMINT, MediumIntegerDataType, BigIntDataType, BIGINT } from '../lib/data-types';
let tinyint: IntegerDataType;
tinyint = TINYINT();
tinyint = new TINYINT();
tinyint = TINYINT.UNSIGNED.ZEROFILL();
tinyint = new TINYINT.UNSIGNED.ZEROFILL();
let smallint: SmallIntegerDataType;
smallint = SMALLINT();
smallint = new SMALLINT();
smallint = SMALLINT.UNSIGNED.ZEROFILL();
smallint = new SMALLINT.UNSIGNED.ZEROFILL();
let mediumint: MediumIntegerDataType;
mediumint = MEDIUMINT();
mediumint = new MEDIUMINT();
mediumint = MEDIUMINT.UNSIGNED.ZEROFILL();
mediumint = new MEDIUMINT.UNSIGNED.ZEROFILL();
let int: IntegerDataType;
int = INTEGER();
int = new INTEGER();
int = INTEGER.UNSIGNED.ZEROFILL();
int = new INTEGER.UNSIGNED.ZEROFILL();
let bigint: BigIntDataType;
bigint = BIGINT();
bigint = new BIGINT();
bigint = BIGINT.UNSIGNED.ZEROFILL();
bigint = new BIGINT.UNSIGNED.ZEROFILL();
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!