Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
Restrict importing specific named exports in TypeScript project

I have a react-native project I am building with TypeScript, and react-native exports an Alert class that takes some arguments and displays an alert message to the user. I needed an Alert component with more capabilities than the one provided by react-native, so I built one, styled it to match the rest of the app, and refactored the whole project to use that one instead. I also called it Alert and it takes similar arguments.

Now, though, I would like to restrict other devs from importing Alert from 'react-native' by displaying an error, even if just a linting error, and direct them to import from '/Alert' instead. This will ensure all alerts in the app look the same.

How do I go about doing this? From what I've seen, it looks like there are several solutions that allow developers to restrict imports to specific modules from specific files, but I don't want to restrict the entire 'react-native' modules as every single component needs to import at least one or two things from it (Like View, Text, etc)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!