Google News
logo
TypeScript - Interview Questions
Relative vs. non-relative module import for a custom module in Typescript.
You can resolve module imports differently based on whether the module reference is relative or non-relative.
 
A relative import starts with /, ./ or ../. 
 
Example, 
import Entry from "./components/Entry";
import { DefaultHeaders } from "../constants/http";
* Any other import is considered non-relative.

Example, 
import * as $ from "jquery";
import { Component } from "@angular/core";
 
* You can use relative imports for our modules that are guaranteed to manage their relative location at runtime.
* You can resolve non-relative imports through path mapping or relative to baseUrl.
Advertisement