feat(markdown-parser): support Longs in interpolation
This commit is contained in:
parent
9ff8f9d33f
commit
e081fddbc2
1 changed files with 4 additions and 2 deletions
|
@ -135,7 +135,7 @@ function unparse(input: InputText): string {
|
||||||
|
|
||||||
function parse(
|
function parse(
|
||||||
strings: TemplateStringsArray | string,
|
strings: TemplateStringsArray | string,
|
||||||
...sub: (InputText | MessageEntity | boolean | number | undefined | null)[]
|
...sub: (InputText | MessageEntity | Long | boolean | number | undefined | null)[]
|
||||||
): TextWithEntities {
|
): TextWithEntities {
|
||||||
const entities: tl.TypeMessageEntity[] = []
|
const entities: tl.TypeMessageEntity[] = []
|
||||||
let result = ''
|
let result = ''
|
||||||
|
@ -397,6 +397,8 @@ function parse(
|
||||||
|
|
||||||
if (typeof it === 'string' || typeof it === 'number') {
|
if (typeof it === 'string' || typeof it === 'number') {
|
||||||
result += it
|
result += it
|
||||||
|
} else if (Long.isLong(it)) {
|
||||||
|
result += it.toString(10)
|
||||||
} else {
|
} else {
|
||||||
// TextWithEntities or MessageEntity
|
// TextWithEntities or MessageEntity
|
||||||
const text = it.text
|
const text = it.text
|
||||||
|
@ -447,7 +449,7 @@ export const md: {
|
||||||
*/
|
*/
|
||||||
(
|
(
|
||||||
strings: TemplateStringsArray,
|
strings: TemplateStringsArray,
|
||||||
...sub: (InputText | MessageEntity | boolean | number | undefined | null)[]
|
...sub: (InputText | MessageEntity | Long | boolean | number | undefined | null)[]
|
||||||
): TextWithEntities
|
): TextWithEntities
|
||||||
/**
|
/**
|
||||||
* A variant taking a plain JS string as input
|
* A variant taking a plain JS string as input
|
||||||
|
|
Loading…
Reference in a new issue