TypeScript Type <any>的等效scala类型是什么

时间:2019-04-16 18:13:50

标签: angular scala.js

我正在使用TypeScript库(角度),该库具有将Type作为参数的函数:

curl -X POST https://api.sandbox.paypal.com/v1/payments/payouts \
  -H "content-type: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -d '{
  "sender_batch_header": {
    "sender_batch_id": "1524086406556",
    "email_subject": "This email is related to simulation"
  },
  "items": [
  {
    "recipient_type": "EMAIL",
    "receiver": "payouts-simulator-receiver@paypal.com",
    "note": "ERRPYO002",
    "sender_item_id": "15240864065560",
    "amount": {
      "currency": "USD",
      "value": "1.00"
    }
  }]
}'

但是我不知道如何在我的Scala代码中定义它。具体来说,如果还有[],则Type [any]对应的scala类型是什么:

ComponentFactoryResolover.resolveComponent(component: Type<any>)

1 个答案:

答案 0 :(得分:0)

Scala.js对于运行时类值(或构造函数)没有非常特定的类型。由于我们传递给此类参数的实际值通常是为某些js.constructorOf[Foo]调用Foo并返回js.Dynamic的结果,因此我建议翻译TypeScript的{{1} }放入Scala.js中的Type<T>