代码之家  ›  专栏  ›  技术社区  ›  Ogglas

Visual Studio ReSharper-在外部模块中声明的Typescript自动导入类-使用from而不是require

  •  0
  • Ogglas  · 技术社区  · 7 年前

    使用JetBrains ReSharper Ultimate 2018.3.4并使用命令 Import 'class '' declared in external module ''' and all other types require from 相反,就像VisualStudio通常做的那样。如何启用此功能?

    从ReSharper生成的代码:

    import Requests = require("../../../requests");
    import ApiPaths = Requests.ApiPaths;
    

    enter image description here

    import { ApiPaths } from '../../../requests';
    

    enter image description here

    0 回复  |  直到 7 年前
        1
  •  4
  •   amoss    7 年前

    在ReSharper选项中,导航到代码编辑->打字稿->代码样式->别名

    推荐文章