question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote declaration file

See original GitHub issue

Search Terms

  • Remote Reference
  • Remote Declaration
  • Declaration URL

Suggestion

Being able to reference .d.ts files from a remote location

Use Cases

Reference .d.ts files which can match with import “http://example.com/Component1

Examples

/// <referance path="http://example.com/Definitions/Component1" />
import "http://example.com/Component1"

Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:37
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
zheeengcommented, Mar 14, 2019

I made a solution for it:

  1. Install the types file: yarn add -D @types/Component1
  2. At the project folder, create a declaration file modules.d.ts with content:
module 'http://example.com/Component1' {
  import content = require('Component1');

  export = content
}
  1. enjoy
import everything from 'http://example.com/Component1'

We have to have a local declaration for supporting intelligence

14reactions
naivefuncommented, Dec 8, 2020

Module Federation could be a great scenario?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to reference type existing declaration file at different path?
I have tried (as the type error suggests) to create a new type declaration file. declare module 'somepackage/esm/somepackage.esm'. This will get ...
Read more >
Documentation - Introduction - TypeScript
The Declaration Files section is designed to teach you how to write a high-quality TypeScript Declaration File. We need to assume basic familiarity...
Read more >
Types and Type Declarations | Manual - Deno
When TypeScript is type checking a file, it only cares about the types for the ... Similar to the triple-slash directive, Deno supports...
Read more >
TypeScript Types for Federated Modules and Microfrontends
d.ts files and emits type declarations that match the federated module's configuration; webpack-remote-types-plugin – a Webpack plugin that ...
Read more >
Duplicate declaration - Google Groups
I have made a module, a long time ago, that allows me to create directories and httpd config files. My pattern is /var/www/dev/$devuser/$clientname/$appname/....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found