[英]How to hide a base TypeScript type with an imported type
I am importing the following type with TypeScript 1.8: 我正在使用TypeScript 1.8导入以下类型:
import { Option } from "react-select-props";
However when I try to create an object of type Option, Intellisense thinks it corresponds to the following type from the core library: 但是,当我尝试创建Option类型的对象时,Intellisense认为它对应于核心库中的以下类型:
declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };
It compiles with the correct type from react-select-props
however. 但是,它会使用
react-select-props
的正确类型进行编译。 Am I missing something? 我想念什么吗? How to hide this base type with the imported type and make sure Intellisense reflects this?
如何用导入的类型隐藏此基本类型,并确保Intellisense能够反映这一点? I am using Visual Studio 2015 Update 3, and TypeScript Tools 2.0.6.
我正在使用Visual Studio 2015 Update 3和TypeScript Tools 2.0.6。
You can rename it: 您可以重命名:
import { Option as ReactPropsOption } from "react-select-props";
let options: ReactPropsOption = {};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.