Hacker News new | ask | show | jobs
by tjansen 1106 days ago
I have found ChatGPT to give bad answers for more complicated questions. For example, the other day I encountered some TypeScript code that surprised me. Basically it was:

class A { @SomeDecorator() x: string }

const value: A = {x: "foo"};

I was surprised that it compiled at all and structural typing applied to classes, even though '!(value instanceof A)'. But it worked! I asked ChatGPT for more information about this, and basically it just told me that it wouldn't compile, which was obviously wrong.