我正在尝试适应本文中描述的传统提交消息。
这是文章的一个片段:
允许<type>值:
feat (new feature)
fix (bug fix)
docs (changes to documentation)
style (formatting, missing semi colons, etc; no code change)
refactor (refactoring production code)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)
Run Code Online (Sandbox Code Playgroud)
但有时有些变化很难归类为此类。我将列出一些关于使用哪种类型感到困惑的更改
在这种情况下我应该使用什么类型
package.json、.prettierc等。我知道 Firebase 不允许您使用 3rd 方电子邮件服务发送电子邮件。所以唯一的方法是通过 Gmail 发送。
所以我在互联网上搜索了一些方法,所以这里有一个片段,它可以让我免费发送电子邮件。
export const shareSpeechWithEmail = functions.firestore
.document("/sharedSpeeches/{userId}")
.onCreate(async (snapshot, context) => {
// const userId = context.params.userId;
// const data = snapshot.data();
const mailTransport = nodemailer.createTransport(
`smtps://${process.env.USER_EMAIL}:${process.env.USER_PASSWORD}@smtp.gmail.com`
);
const mailOptions = {
to: "test@gmail.com",
subject: `Message test`,
html: `<p><b>test</b></p>`
};
try {
return mailTransport.sendMail(mailOptions);
} catch (err) {
console.log(err);
return Promise.reject(err);
}
});
Run Code Online (Sandbox Code Playgroud)
我想创建一个模板,所以我使用了这个名为email-templatesnodemailer 的包。但该函数不会在 Firebase 控制台中执行,也不会显示错误并显示与“计费”相关的警告。
export const shareSpeechWithEmail = functions.firestore
.document("/sharedSpeeches/{userId}")
.onCreate(async (snapshot, context) => {
const email = …Run Code Online (Sandbox Code Playgroud) 我正在查看角度存储库的源代码,偶然发现了一行使用多种类型断言的代码。
代码看起来有点像这个,它使用 2 种类型断言:unknown和Record<string, unknown>
(window as unknown as Record<string, unknown>)['ResizeObserver']
Run Code Online (Sandbox Code Playgroud)
这是实际文件的链接。
多重断言实际上意味着什么?