Source: www.amitmerchant.com

Avoid relative import paths in TypeScript
If you have been working with https://www.typescriptlang.org/ lately, you might have used relative paths to import modules or files. So, for instance, let’s say if I want to import a module that is two directories up from the current file location, I would need to import it like so.

To fix this, all you need is to set a compilerOptions.baseUrl config in your project’s tsconfig.json file.

Now, you won’t need to write those pesky relative import paths anymore.

import Order from 'components/order'; This will get resolved to./src/components/order.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners