jjzjj

javascript - TypeScript 可更新和枚举引用

我有一个用JavaScript编写的外部SDK,我正在使用它。这些模块之一,Blob是可更新的,但也公开了一个枚举FooEnum(成员Bar和Baz).在JavaScript中使用此SDK的代码如下:constblobInstance=newSdk.Blob();constfooType=Sdk.Blob.FooEnum.Baz;我现在正在尝试编写一个接口(interface),我可以将此SDK转换到该接口(interface),以提供一些类型安全性。这是我到目前为止所得到的:interfaceBlobInterface{}enumFoo{Bar,Baz}interfaceSdk{Bl

c++ - 强枚举 typedef : clang bug or c++11 standard uncertainty?

对于这样的代码:typedefenumFooEnum:intFooEnum;enumFooEnum:int{A=1,B};clang(linux/7.0.0)报告没有错误[-c-std=c++11-pedantic],但是gcc(linux/8.2.1)不编译它:g++-c-std=c++11-pedantictest2.cpptest2.cpp:1:28:error:expected';'or'{'before'FooEnum'typedefenumFooEnum:intFooEnum;^~~~~~~test2.cpp:1:28:error:expectedclass-keybefo