相关疑难解决方法(0)

Typescript 中有 Base64 编码图像的类型吗?

作为 Typescript 新手,我尝试尽可能准确地输入所有内容,作为学习过程的一部分。

\n

我有一个lqip来自 CMS 的(低质量图像占位符)属性,它应该是 base64 编码的图像。它显然是一个字符串,但将其作为字符串输入感觉有点不精确。

\n
mainImage: Schema.Post["mainImage"] & {\n  //  can I be more precise? It should be always a base64 encoded image, not just a generic string\xe2\x80\xa6\n  // e.g. "data:image/jpeg;base64,/9j/2wBDAAYEB\xe2\x80\xa6"\n  lqip: string\n}\n
Run Code Online (Sandbox Code Playgroud)\n

Typescript 中有 Base64 编码图像的类型吗?我尝试广泛搜索谷歌,但我只找到了有关atob/btoa转换的主题,而不是类型本身。谢谢!

\n

base64 typescript typescript-typings

7
推荐指数
2
解决办法
1万
查看次数

如何在打字稿中代表Guid?

假设我有这个C#类别

public class Product
{
   public Guid Id { get; set; }
   public string ProductName { get; set; }
   public Decimal Price { get; set; }
   public int Level { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

等效的打字稿如下所示:

export class Product {
  id: ???;
  productName: string;
  price: number;
  level: number;
}
Run Code Online (Sandbox Code Playgroud)

如何在打字稿中代表Guid?

c# typescript

6
推荐指数
2
解决办法
4417
查看次数

标签 统计

typescript ×2

base64 ×1

c# ×1

typescript-typings ×1