Code Monkey home page Code Monkey logo

clone-class's Introduction

Mr. Huan Li is a serial entrepreneur and active angel investor with a strong technology background. He is a widely recognized technical leader in conversational AI and open-source cloud architectures. Huan is a GitHub Star, top open-source contributor in both US(#4) and China(#7), co-authored guide books "Chatbot 0 to 1" and "Concise Handbook of TensorFlow 2" and has been recognized by Microsoft, Google, and Tencent as MVP, GDE, and TVP. He is a Chatbot Architect and regularly speaks at technical conferences worldwide. Please find out more about his experiences at https://www.linkedin.com/in/huan42/

Wechaty

TypeScript ES Modules NPM Version Downloads Docker Pulls GitHub stars Discord

Huan is the creator and core developer of Wechaty Wechaty GitHub Stars. Wechaty is a Conversational RPA SDK for chatbot makers. With only six lines of code, you can create a bot on the most popular IMs like WeChat, Whatsapp, WeCom, Gitter, QQ, etc.

Star History Chart

Some numbers for the Wechaty project:

Below are his contributions (PRs and Issues) to GitHub open-source projects:

  • ♏️ means he is the creator or maintainer of the project
  • ©️ means he has contributed to the project

Chatbot Ecosystem

Chatbot Projects

Machine Learning & Conversational AI

Community

RxJS & Event-driven Programming

OpenAPI

Docker & Networking

Remote Procedure Call (RPC)

Database

Frida & Assembly

TypeScript

Web & Apps

Library & Tools

clone-class's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar huan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clone-class's Issues

Can not infer the private constructor return type.

I want to know what is the InstanceType of a class with private constructor:

class PrivateConstructorClass {
  private constructor () {}
}

function test<T> (klass: T) {
  // T here is `typeof PrivateConstructorClass`
}

test(PrivateConstructorClass)

How can I get the type PrivateConstructorClass instead of typeof PrivateConstructorClass in method test()?

Related unit tests

test('constructor()', async t => {
class PrivateConstructorClass {
private constructor () {}
}
const C = constructor(PrivateConstructorClass)
const typeTest: AssertEqual<typeof C, PrivateConstructorClass> = true
t.ok(typeTest, 'should be same after constructor')
})

If we can fix the above unit test, then we are solved this problem.

Related links

  1. SO: Typescript reference class with private constructor
  2. SO: reverse operation of typeof in typescript
  3. Types for classes as values in TypeScript
  4. Class-related types in TypeScript

TypeError: Cannot read property 'valueDeclaration' of undefined

$ git clone [email protected]:huan/clone-class.git
$ cd clone-class
$ git checkout f87276a443eb5d11e78d0ce21819b89ac16452d1
$ npm install
$ npx tsc --version
Version 4.4.3

$ npx tsc 
/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:92656
                throw e;
                ^

TypeError: Cannot read property 'valueDeclaration' of undefined
    at checkIndexConstraints (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:66778:47)
    at checkClassLikeDeclaration (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:67070:17)
    at checkClassDeclaration (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:66966:13)
    at checkSourceElementWorker (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:68323:28)
    at checkSourceElement (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:68165:17)
    at Object.forEach (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:132:30)
    at checkBlock (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:65555:20)
    at checkSourceElementWorker (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:68286:28)
    at checkSourceElement (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:68165:17)
    at checkFunctionOrMethodDeclaration (/Users/huan/git/huan/clone-class/node_modules/typescript/lib/tsc.js:65253:13)

Behavior not expected when the class static property initialized in defination.

In the past two days, I'm experiencing a wired "bug" when using cloneClass:

class Test {
  static meaning = { life: 42 }
}

const T1 = cloneClass(Test)
const T2 = cloneClass(Test)

T1.meaning.life = 17
console.log(T2.meaning.life)
// output 17!!! but we are expecting 42 at here.

After digging into the implementation of the cloneClass, I found that when a static property of the class is cloning, we will copy the value of the static property value to the cloned class.

Which means that the Object value will be shared between all the cloned classes.

So finally we have to check this situation and throw an Error in the cloneClass to forbidden initializing the static property in the class.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.11.0 to 10.11.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).
  • Travis CI - Branch: The build failed.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.