Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
onionhammer opened this issue Mar 8, 2019 · 2 comments

Comments

@onionhammer
Copy link
Contributor

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

  • OS platform and version: macOS latest
  • Node Version: v11.10.1
  • NPM package version or commit ID: hyco-https: ^1.3.0
@onionhammer
Copy link
Contributor Author

onionhammer commented Mar 8, 2019

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
Copy link

jfggdl commented Oct 27, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants