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.

[Typescript] Options type is not exported

See original GitHub issue

Hi,

I used the @types/http-proxy-middleware which expord a Config type. When i upgrade to the last version of http-proxy-middleware, i have the following error with this code:

import createProxyMiddleware, { Options } from 'http-proxy-middleware';
TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

Can you export the Options type in index.d.ts?

Regards

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
chimuraicommented, Feb 18, 2020

Published version v1.0.0 to npm More details: https://github.com/chimurai/http-proxy-middleware/releases

@bender316 RequestHandler is now exported also. (removed the I prefix from interface name)

Thanks for reporting the issue! Hope it didn’t cause too much inconvenience.

0reactions
raph90commented, Aug 20, 2020

Hi I’m not sure if this is relevant but webpack-dev-server is kicking up a fuss with ‘node_modules/http-proxy-middleware/dist/index"’ has no exported member ‘Config’.’ Here is my tsconfig:

{
  "compilerOptions": {
    "target": "ES2019",
    "sourceMap": true,
    "module": "commonjs",
    "esModuleInterop": true,
    "declaration": true,
    "resolveJsonModule": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "outDir": "../../dist/server",
    "lib": ["ES2019"],
    "moduleResolution": "node",
    "types": ["node"],
    "incremental": true,
    "composite": true
  },
  "include": ["**/*.ts"],
  "exclude": ["**/*.test.ts"],
  "references": [{ "path": "../shared" }]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript errors when importing a "not exported" type, even ...
Typescript 3.8 introduces new syntax for type-only imports and exports: import type T from './module'; import type { A, B } from '....
Read more >
Documentation - TypeScript 3.8
import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there's no remnant of...
Read more >
types exported via 'export type' not resolved : WEB-16894
Typescript : types exported via 'export type' not resolved ; import BlahModule = ; ( ; /BlahModule') ;; export class ; Yo { ......
Read more >
How to export a Type in TypeScript | bobbyhadz
Use a named export to export a type in TypeScript, e.g. export type Person = {} . The exported type can be imported...
Read more >
Avoid Export Default - TypeScript Deep Dive - Gitbook
If you refactor Foo in foo.ts it will not rename it in bar.ts . · If you end up needing to export more...
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