运行“git stash”时出现此错误
Cannot save the current status
Run Code Online (Sandbox Code Playgroud)
没有其他信息。
这是为什么?
我正在运行 firebase 模拟器。
我的应用程序可以调用 firebase 云函数,如果允许用户(取决于数据库中的值),该函数可以创建自定义用户声明
我正在尝试调用该函数:
import * as firebase from '@firebase/testing';
import * as fs from 'fs';
const app = firebase.initializeTestApp({
databaseName: 'mydb',
auth: {
uid: 'useruid'
},
});
describe('Firebase Functions', () => {
beforeEach(async () => {
await firebase.loadDatabaseRules({
databaseName: 'mydb',
rules: fs.readFileSync('database.rules.json', 'utf8'),
});
});
afterAll(async () => {
await Promise.all(firebase.apps().map((app) => app.delete()));
});
const cloudfunction = app.functions().httpsCallable('cloudfunction')
it('throws error if user is not authenticated', async () => {
await firebase.assertFail(cloudfunction())
})
});
Run Code Online (Sandbox Code Playgroud)
这是抛出一个错误:
错误:错误:预检响应具有无效的 HTTP …
javascript firebase-tools firebase-authentication google-cloud-functions
我可以使用 React 路由器的useNavigate
钩子转到类似 的嵌套路由localhost:3000/nested/route
,但是一旦重新加载,我就会收到 404 未找到错误,因为它试图localhost:3000/nested/route/index.html
出于某种原因进行查找。
如何将开发中的Vite配置为具有客户端路由的SPA,以便所有请求都重定向到根index.html?
我有一个“Food”对象,它可以有多种类型,具体取决于“category”属性的值。该对象来自json,因此之前不可能知道类型。
\n我正在尝试在类别道具上使用 switch 语句,以便将 Food 对象转换为正确的类型
\n\nexport type Category = \'fruit\' | \'grain\' | \'meat\'\n\ninterface Food<IngredientCategory extends Category> {\n name: string;\n category: IngredientCategory\n [key: string]: string;\n}\n\ninterface Fruit extends Food<\'fruit\'> {\n color: string;\n}\n\ninterface Grain extends Food<\'grain\'>{\n size: string;\n}\n\ninterface Meat extends Food<\'meat\'> {\n temperature: string\n}\n\ntype FoodFromCategory<IngredientCategory extends Category> = IngredientCategory extends \'fruit\' ? Fruit : IngredientCategory extends \'grain\' ? Grain : Meat;\n\nconst castFood = <IngredientCategory extends Category>(category: IngredientCategory, food: Food<any>):\n Food<IngredientCategory> | undefined => {\n switch (category) {\n case "fruit":\n …
Run Code Online (Sandbox Code Playgroud)