|
declare interface String { |
|
arg: (obj: object, encode?: boolean | string, def?: string) => string; |
|
bae64ContentType: () => string; |
|
bae64ToBuffer: () => string; |
|
bae64ToFile: (filename: string, callback?: (err: any) => void) => string; |
|
capitalize: (first?: boolean) => string; |
|
count: (word: string) => string; |
|
crc32: (unsigned?: boolean) => string; |
|
decode: () => string; |
|
decrypt_uid: (secret?: string) => string; |
|
decrpyt: (key: string, secret?: string) => string; |
|
encode: () => string; |
|
encrypt_uid: (secret?: string) => string; |
|
encrpyt: (key: string, unique: boolean, secret?: string) => string; |
|
format: (param1?: string, param2?: string, param3?: string, param4?: string, param5?: string) => string; |
|
fromUnicode: () => string; |
|
hash: (type?: string, salt?: string) => string; |
|
isBase64: () => boolean; |
|
isBoolean: () => boolean; |
|
isEmail: () => boolean; |
|
isJSON: () => boolean; |
|
isPhone: () => boolean; |
|
isUID: () => boolean; |
|
isURL: () => boolean; |
|
isZIP: () => boolean; |
|
keywords: (forSearch?: boolean, alternative?: boolean | string, max_count?: number, max_lenght?: number, min_length?: number) => string[]; |
|
makeid: () => string; |
|
max: (maxLenght: number, chars?: string) => string; |
|
md5: (salt?: string) => string; |
|
padLeft: (max: number, char?: string) => string; |
|
padRight: (max: number, char?: string) => string; |
|
params: (obj: object) => string; |
|
parseBool: () => boolean; |
|
parseComponent: (tags: object) => any; |
|
parseCSV: (delimeter?: string) => any[]; |
|
parseDate: () => Date; |
|
parseDateExpiration: () => Date; |
|
parseENV: () => any; |
|
parseFloat: (def?: object) => number; |
|
parseFloat2: (def?: object) => number; |
|
parseInt: (def?: object) => number; |
|
parseInt2: (def?: object) => number; |
|
parseJSON: () => object; |
|
parseQuery: () => object; |
|
parseTerminal: (fields: string[], fnLine: (values: any, index: any, count: any, realIndex: any) => void, skipLines?: number, takeLines?: number) => object; |
|
parseUA: (structured?: boolean) => string | object; |
|
parseXML: (replace?: boolean) => object; |
|
pluralize: (zero: string, one: string, few: string, other: string) => string; |
|
removeTags: () => string; |
|
ROOT: (noremap?: boolean) => string; |
|
sha1: (salt?: string) => string; |
|
sha256: (salt?: string) => string; |
|
sha512: (salt?: string) => string; |
|
slug: (max?: number) => string; |
|
startWith: (value: string, ignoreCase?: boolean) => boolean; |
|
toASCII: () => string; |
|
toSearch: () => string; |
|
toUnicode: () => string; |
|
trim: () => string; |
|
} |
|
|
|
declare interface Number { |
|
add: (value: number, decimals?: number) => number; |
|
async: (onNumber: (number: number, mext: () => void) => void, onComplete: () => void) => number; |
|
between: (condition: object, otherwise: object) => number; |
|
currency: (currency: string) => string; |
|
discount: (percentage: number, decimals?: number) => number; |
|
filesize: (decimals?: number, type?: string) => string; |
|
floor: (decimals?: number) => number; |
|
format: (decimals?: number, separator?: string, decimalSeparator?: string) => string; |
|
hex: (length: number) => string; |
|
padLeft: (max: number, char?: string) => string; |
|
padRight: (max: number, char?: string) => string; |
|
parseDate: (plus?: number) => number; |
|
pluralize: (zero: string, one: string, few: string, other: string) => string; |
|
VAT: (percentage: number, decimals?: number, includeVAT?: boolean) => number; |
|
round: (decimals?: number) => number; |
|
} |
|
|
|
declare interface Date { |
|
add: (expression: string | number) => Date; |
|
extend: (type: string, count: number) => Date; |
|
format: (format?: string, resource?: string) => string; |
|
setTimeZone: (timezone: string) => Date; |
|
toUTC: (ticks?: boolean) => Date | number; |
|
} |
|
|
|
declare interface Array<T> { |
|
async: (threadCount?: number, onComplete?: () => void) => T; |
|
findAll: (fn: (item: any, next: () => void) => void) => T; |
|
findItem: (fn: (item: any, next: () => void) => void) => any; |
|
findValue: (prop: string, value: object, path: string, def?: object) => any; |
|
first: (def?: object) => any; |
|
last: (def?: object) => any; |
|
limit: (max: number, fn: (items: any, next: () => void) => void, callback?: () => void) => T; |
|
quicksort: (path: string, asc: boolean | string) => T; |
|
random: () => T; |
|
remove: (fn: (item: any, index: any) => void) => T; |
|
skip: (count: number) => T; |
|
take: (count: number) => T; |
|
toObject: (name?: string) => any; |
|
trim: () => T; |
|
wait: (onItem: (item: any, next: () => void) => void, callback?: () => void, threadCount?: number) => T; |
|
} |
Describe the bug
I'm using total in a TypeScript project. Types are fine except for the custom functions in prototype of
String,Number,Date, andArraydefined here:framework4/index.d.ts
Lines 294 to 397 in f9c5f2a
Basically VS Code says that for example the function
lastin an Array doesn't exists... After a while I've discovered that if a move all the interface declaration inside thedeclare globalblock it works:I don't know why exactly I got this issue, but I thought might be good to report. This is my
tsconfig.json{ "compilerOptions": { "target": "es2020", "module": "commonjs", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "strictPropertyInitialization": false, "types": ["total4", "@types/node"], "noImplicitThis": false } }Must gather (please complete the following information):