Azure / azure-relay-node

☁️Node.js library for Azure Relay Hybrid Connections
https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-what-is-it
MIT License
12 stars 15 forks source link

' http.ServerResponse = https.ServerResponse;' hack doesnt work great with typescript #27

Open onionhammer opened 5 years ago

onionhammer commented 5 years ago

Actual Behavior

  1. Cannot assign to 'ServerResponse' because it is a read-only property.ts(2540)

Expected Behavior

  1. Dont have to use silly hacks to use hyco with libs like express

Versions

onionhammer commented 5 years ago

Yet Another workaround

Create a 'hack.js' file, enable 'allowJS' in tsconfig, and include following content

import * as http from 'http';
import * as https from 'hyco-https';

http.ServerResponse = https.ServerResponse;

export { }

Then in your index.ts include the hack before including 'express'


import './hack';
import * as express from 'express';
jfggdl commented 3 years ago

FYI - We are planning activities to improve our SDKs. This items in being under consideration.