小编Dav*_*ret的帖子

Firebase Cloud 函数:Typescript 无法编译为 JavaScript

我的计算机上的云功能可以使用 Javascript,但是当我使用 TypeScript 尝试它时,它不会编译为 Javascript。它不会创建 lib/index.js 事件

\n\n

当我运行 firebase 部署时,它显示以下错误

\n\n
Error: There was an error reading functions/package.json:\n
Run Code Online (Sandbox Code Playgroud)\n\n

firebase deploy --debug 显示以下日志:

\n\n
APPLEs-MacBook-Air:functions abbasi$ firebase deploy --debug\n[2020-01-08T08:39:06.383Z] ----------------------------------------------------------------------\n[2020-01-08T08:39:06.390Z] Command:       /usr/local/bin/node /usr/local/bin/firebase deploy --debug\n[2020-01-08T08:39:06.390Z] CLI Version:   7.11.0\n[2020-01-08T08:39:06.390Z] Platform:      darwin\n[2020-01-08T08:39:06.391Z] Node Version:  v12.14.1\n[2020-01-08T08:39:06.392Z] Time:          Wed Jan 08 2020 13:39:06 GMT+0500 (Pakistan Standard Time)\n[2020-01-08T08:39:06.393Z] ----------------------------------------------------------------------\n[2020-01-08T08:39:06.393Z] \n[2020-01-08T08:39:06.422Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]\n[2020-01-08T08:39:06.423Z] > authorizing via signed-in user\n[2020-01-08T08:39:06.426Z] [iam] checking project safepay-test for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]\n[2020-01-08T08:39:06.429Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/safepay-test:testIamPermissions  \n permissions=[cloudfunctions.functions.create, …
Run Code Online (Sandbox Code Playgroud)

node.js firebase typescript google-cloud-functions

3
推荐指数
1
解决办法
5925
查看次数

使用LINQ to Entities获取最后一个字符索引

我收到错误:

LINQ to Entities does not recognize the method 'Int32 LastIndexOf(System.String)' 
method, and this method cannot be translated into a store expression.
Run Code Online (Sandbox Code Playgroud)

使用此代码判断某人的姓氏是否以某些字符开头时:

persons = persons.Where(c => c.FullName.IndexOf(" ") > 0 &&
c.FullName.Substring(c.FullName.LastIndexOf(" ")+1).StartsWith(lastNameSearch));
Run Code Online (Sandbox Code Playgroud)

任何线索如何在不使用LastIndexOf()的情况下实现这一目标?也许在使用ToList()从数据库中获取结果后,我必须检查这个?

c# linq-to-entities

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

如何从变量中删除所有非数字字符

如何从 javascript 变量中删除所有文本字符(不是数字或浮点数)?

function deduct(){
    var getamt= document.getElementById('cf').value; //eg: "Amount is 1000"
    var value1 = 100;
    var getamt2 = (value1-getamt);
    document.getElementById('rf').value=getamt2;
}
Run Code Online (Sandbox Code Playgroud)

我想要getamt作为号码。parseInt正在给出NaN结果。

javascript

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

计时器在本机反应本机组件中不起作用

在我的 JavaScript 中,我start在一些 swift 代码上调用一个方法:

import {NativeModules} from "react-native";

// somewhere in JS
NativeModules.MyTestClass.start();
// somewhere else I'm listening for events from the swift code
const myModule = new NativeEventEmitter(NativeModules.MyTestClass);
const subscription = myModule.addListener("testEvent", message => {
  console.log(message);
});
Run Code Online (Sandbox Code Playgroud)

SWIFT代码:

import Foundation

@objc(MyTestClass)
class MyTestClass: RCTEventEmitter {
  let testEventName = "testEvent"

  override func supportedEvents() -> [String]! {
    return [testEventName]
  }

  @objc func start() -> Void {
    let timer = Timer.scheduledTimer(
        timeInterval: 0.1,
        target: self,
        selector: #selector(self.update),
        userInfo: nil, …
Run Code Online (Sandbox Code Playgroud)

swift react-native

1
推荐指数
1
解决办法
726
查看次数

按列分组.如果为null,则按其他列分组

在实体框架中,我正在使用一个带有自引用列的表,这个列是这样创建的,我无法更改此结构,因为它已经在项目中使用了太多位置:

Entities
--------
CreationDate         | EntityID | OriginalEntityID |    Name
2014-01-02 10:02:02  |   819    |        NULL      | First draft
2014-02-05 14:04:20  |   899    |        819       | Second draft
2014-05-16 02:45:40  |   907    |        819       | Third draft
2014-05-16 02:45:40  |   908    |        NULL      | Other entity
Run Code Online (Sandbox Code Playgroud)

然后还有另一张表就像这样:

EntityValues
------------
EntityValueID | Value | EntityID
       1      |  20   | 819
       2      |  30   | 899
       3      |  25   | 899
       4      |  12   | 907
       5      |  20   | 908
       6 …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework

0
推荐指数
1
解决办法
701
查看次数

更多喜欢这个Azure搜索

我目前正在评估Windows Azure中的新Azure搜索功能.我想知道是否有办法在文档文本中执行类似于lucene/elasticsearch的更多类似于此问题的查询? - 获取并获取与传入文档类似的文档列表.我知道Azure Search在后台使用elasticsearch(Source).

我没有在API中的任何地方找到它,但也许我遗漏了参数中隐藏的内容.我认为这是一个非常有用的功能,如果它不包括在内会很遗憾.

azure

0
推荐指数
1
解决办法
825
查看次数

Foreach不适用于Typescript

我怎样才能使用foreach呢?我想显示所有的名字.

test: [{
    id: "1",
    name: "Tname1"
}, {
    id: "2",
    name: "Tname2"
}]
Run Code Online (Sandbox Code Playgroud)

它不起作用:

this.test.forEach(function(s){
    console.log(s.name);
});
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

-4
推荐指数
1
解决办法
993
查看次数