上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 494 下一页
摘要: Problem to Solve Reparesent a value that is immutable and distinct from other objects based on its properties rather than its identity. Solution Creat 阅读全文
posted @ 2024-08-14 14:52 Zhentiw 阅读(11) 评论(0) 推荐(0)
摘要: Problem to Solve Share functionality between classes without using inheritance. Solution Create a class containing methods that can be used by other c 阅读全文
posted @ 2024-08-14 14:48 Zhentiw 阅读(13) 评论(0) 推荐(0)
摘要: One of the interesting things about verbatimModuleSyntax in TypeScript is that it requires a specific type of import when you're working with types. L 阅读全文
posted @ 2024-08-13 01:29 Zhentiw 阅读(196) 评论(0) 推荐(0)
摘要: To fix the CommonJS export issue, we need to make a change to our tsconfig.json file. Add the verbatimModuleSyntax setting and set it to true: { "comp 阅读全文
posted @ 2024-08-13 01:24 Zhentiw 阅读(300) 评论(0) 推荐(0)
摘要: The module and moduleResolution options in the tsconfig.json file can be confusing. Here we'll discuss the differences between the module and moduleRe 阅读全文
posted @ 2024-08-13 01:17 Zhentiw 阅读(150) 评论(0) 推荐(0)
摘要: class ApplicationError extends Error { get name() { return this.constructor.name; } } class DatabaseError extends ApplicationError {} class UserFacing 阅读全文
posted @ 2024-08-11 22:06 Zhentiw 阅读(15) 评论(0) 推荐(0)
摘要: You can create a javascript file as a bash file: #!/usr/bin/env node console.log("Hello World!") Run the script: ./script.js 阅读全文
posted @ 2024-08-11 22:04 Zhentiw 阅读(17) 评论(0) 推荐(0)
摘要: class Product { name; price; constructor(name, price) { this.name = name; try { this.price = price * 1.30; } catch(e) { throw new Error("Product canno 阅读全文
posted @ 2024-08-11 22:03 Zhentiw 阅读(15) 评论(0) 推荐(0)
摘要: Here we're attempting to import several PNG files into our TypeScript program: import pngUrl1 from "./example1.png"; // red squiggly line under "./exa 阅读全文
posted @ 2024-08-08 19:20 Zhentiw 阅读(30) 评论(0) 推荐(0)
摘要: Here we're importing a function myModuleFunc from my-module: import { myModuleFunc } from "my-module"; // red squiggly line under "my-module" Let's st 阅读全文
posted @ 2024-08-08 19:17 Zhentiw 阅读(28) 评论(0) 推荐(0)
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 494 下一页