Hacker News new | ask | show | jobs
by idontwantthis 1460 days ago
So does spellcheck contain a gigantic array of the English language?
2 comments

Yes. It looks like this:

    export type ValidWords<T extends string> = T extends ""
      ? "valid"
      : T extends `the${infer Rest}` | `of${infer Rest}` | `and${infer Rest}` | ...
the source code to answer your question is directly above your question
I'm inclined to cut someone a bit of slack for not following the link to the implementation if the context suggests deeply nested template meta programming golf is involved. It's surprisingly much less complicated than I would have expected.