Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio ReSharper - Typescript automatic import class declared in external module - Use from instead of require

Tags:

When using JetBrains ReSharper Ultimate 2018.3.4 and using the command Import 'class '' declared in external module ''' and all other types it uses require for import. This works but I would like it to use from instead like Visual Studio normally does. How can this be enabled?

Generated code from ReSharper:

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

enter image description here

Generated code from standard Visual Studio 2017 Professional:

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

enter image description here

like image 372
Ogglas Avatar asked Mar 08 '19 09:03

Ogglas


1 Answers

In ReSharper Options, navigate to Code Editing -> TypeScript -> Code Style -> Aliases

For 'Preferred import statement kind (if possible)', choose 'ES6-style imports'.

like image 133
amoss Avatar answered Nov 26 '22 08:11

amoss