Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
在打字稿中扩展枚举
我希望在枚举中重用某些值 有关如何实现此类功能的任何建议 enum someEnum a Some String b 2 enum extendedEnum c string b someEnum b type someEnumType
typescript
typescripttypings
Typescript:如何在 React 中添加历史对象的类型检查?
我有以下代码 它接收历史对象作为道具 const ChildComponent history gt div div div div
ReactJS
typescript
typescripttypings
根据打字稿中的构造函数参数重载类属性
在我们的代码库中 我们广泛使用导航器和构建器模式来抽象组装分层对象 这的核心是一个Navigator我们用它来遍历不同的类 我目前正在尝试将其迁移到打字稿 但正在努力输入它以利用打字稿的力量 我认为我的问题的核心是我无法使用this作为类上
typescript
typescripttypings
typescriptgenerics
使用 Typescript 从 switch case 返回进行类型推断
函数的类型 type fn01 name string gt void type fn02 age string gt void type fn03 description number gt void 我有这样一个案例 type Opti
typescript
typescripttypings
typescriptgenerics
我应该如何在 TypeScript 2 中使用 @types
到目前为止我们已经习惯了tsd或 更好的版本 typings 但现在 TypeScript 2 提供了新的 types功能 我应该如何将当前项目转换为使用 types 我有 tsd json 某些情况下为typings json 以及所有依
typescript
tsd
typescripttypings
如何将 ThreeJS Collada 加载器与 TypeScript / Angular CLI 结合使用?
我已经安装了三个 node modules three 我已将 Collada 加载程序安装在 node modules three collada loader 这些类型似乎已经包括 Collada 加载程序的类型 node module
nodejs
angular
typescript
threeJs
typescripttypings
如何管理不是通过类型下载的类型定义文件?
我有一个Angular我正在使用的应用程序npm and typings管理拉下我的类型定义文件 d ts for TypeScript 不过我有几个 d ts不存在的文件typings并且可以手动滚动或从备用源手动下载 从项目结构的角度来
angularJS
typescript
typescripttypings
Typescript 将元组的类型元组转换为元组(展平元组)
我有这个 Type T Params lt Tuple1 Tuple2 gt eg string number 制作方法 压扁 Type Flatten
typescript
typescripttypings
typescriptgenerics
创建一个接受对象但不接受数组的通用函数
我想创建一个满足以下条件的通用 TypeScript 函数 f a 1 success f undefined success f should fail the type check f 1 2 should fail the type
typescript
typescripttypings
typescriptgenerics
玩笑完成回调不可分配给 ProvidesCallback 或未定义类型的参数
我正在尝试用笑话创建一个测试 我想使用done 回调但 Typescript 不接受它 我尝试使用 typeany jest DoneCallback或者不加任何类型但又不起作用 有什么解决方案或想法吗 it implements opti
nodejs
jestjs
typescripttypings
tsjest
允许类 Typescript 类型中的任意属性
我在 Typescript 中创建了一个泛型类 以从构造函数中传递的对象开始扩展对象 通过代理 该代理将在构造函数中返回 class MyClass
typescript
typescripttypings
TypeScript 2:非类型化 npm 模块的自定义类型
尝试后发布的建议其他地方 我发现自己无法运行使用非类型化 NPM 模块的打字稿项目 下面是一个最小的示例和我尝试的步骤 对于这个最小的例子 我们假设lodash没有现有的类型定义 因此 我们将忽略该包 types lodash并尝试手动添加
typescript
npm
typescripttypings
排除/覆盖 npm 提供的类型
我有一个 npm 包 里面写得不好 打字也过时了 我已经编写了自己的类型 现在我想知道是否可以以某种方式从 npm 包中排除原始类型 它不是一个简单的接口扩展 原来的在这一点上基本上是垃圾 当然 使用 tsconfig json 中的排除列
typescript
typescripttypings
TS(2352) 声明具有动态属性的对象和一个具有特定类型的属性
我需要创建一个对象 该对象将包含一个名为 state 的属性 该属性将具有通用类型 所有其他属性将是具有覆盖上下文的函数 我不确定这是否可能 因此我决定写在这里 我有一个代码 declare interface ContextModule
typescript
typescripttypings
typescript20
Typescript 类型、泛型和抽象类
我尝试了一种对我来说似乎很奇怪的行为 让我们考虑以下示例 在 Typescript Playground 中测试它 abstract class FooAbstract abstract bar class Foo extends FooA
generics
typescript
abstract
typescripttypings
TypeScript:元组类型到对象类型
考虑这样的元组 type MyTuple A B where A and B两者都有一个名为key 例如 interface A key sandwiches interface B key pasta 我想要以下界面 interface
typescript
typescripttypings
Typescript 不会复制 d.ts 文件来构建
所以也许我很困惑 但我想如果我添加declaration true到我的 tsconfig json 我可以让它 tsc 复制我的 d ts文件 以及转译的代码和它的d ts files EG src lib types d ts foo
typescript
typescripttypings
dts
在打字稿中“扩展”实际上意味着什么?
在联合类型的情况下 我无法完全掌握 extends 关键字的使用 这是一个代码片段 解释了我的困惑 class SomeClass someClassProp string class SomeExtendedClass extends S
typescript
typescripttypings
是否可以声明一个接受超类实例数组并返回最具体的子类类型的函数
我正在为我的 Javascript 包编写 Typescript 声明文件 我的库有一个函数 它接受超类元素数组并返回超类 function x args SuperClass SuperClass 我想修改该方法的返回类型 以便它返回最具
typescript
typescripttypings
VS Code,打字 - 无 IntelliSense
我有一个具有以下 缩短的 结构的项目 app app css app js home home css home html home js jsconfig json package json tsconfig json typings g
javascript
json
VisualStudioCode
typescripttypings
«
1
2
3
4
5
6
7
»