microsoft / microsoft/TypeScript

[RFC] Towards an Intelligent and Interactive TypeScript

Open
#43,491 3 comments 41 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: Error Messages In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Background

One of the biggest problems for newcomers is how unapproachable build tools can be. Users often have to deal with rough compiler messages and are faced day-to-day with with harsh statements like "token expected", "no files specified", or "this isn't really what you grew up wanting to do".

People need to be treated like people. This is our fundamental mantra. We must reject the cold mechanical grips of today's build tools, and build humane build tools for humans. For this, we must turn our sights from the work of the last century towards a nascent but thriving field: Artificial Intelligence.

ELIZA and Humane Interactive Artificial Intelligence

I propose that we partner with Artificial Intelligence experts to integrate ELIZA, a groundbreaking implementation of the human brain, into the TypeScript compiler.

ELIZA not only communicates issues on a human level - it is interactive. Instead of running a set of .ts and .tsx punchcards into a mainframe or whatever, ELIZA will allow you to engage on a terminal to speak directly with the TypeScript compiler.

Here is an example of an error TypeScript provides today:

example/foo.ts:9:6 - error TS1005: '}' expected.

9 |   }
       

  example/foo.ts:6:30
  6 | function foo(thing: boolean) {
                                   ~
  The parser expected to find a '}' to match the '{' token here.

What exactly is a "parser" and why is it trying to "find" a "token" "here"?

ELIZA won't do this. ELIZA has HEART (Humanoid Empathy And Raw Tomatoes). Here is an example of ELIZA in ACTION (Autonomy Complete To Intelligent Organization - Nice!).

ELIZA: Is there something bothering you, that you'd like to talk about?

YOU: function doSomething() { } function foo(thing: boolean) { if (thing) { doSomething(); }.

ELIZA: By the way, please understand that I can't always give you an attuned response.
-- But, please go on.

YOU: That was the end of my code.

ELIZA: That is interesting. Please continue.

There! ELIZA knows that your code can't be complete because it's missing a curly brace! No need to talk about parsers and tokens or even mention the word "error"!

TypeScript integration can be done across different implementations of ELIZA. This is useful if you need to change things up or get a second opinion on your code. Here's a similar interaction with a different ELIZA implementation.

> Hello, I am Eliza. I'll be your therapist today. 

*  function doSomething() {      }  function foo(thing: unknown) {     if (thing) {         doSomething();     }

> It is nice to be chatting with you. 

* Thank you, it is nice to be chatting with you too!

> We were discussing you, not me. 

* Uh, okay, good point. I'm just wondering if I wrote my code good

> How long have you been just wondering if you wrote your code good?

* I guess ever since I started coding I've been dealing with some level of imposter syndrome. When I first interviewed at Microsoft for an intern position, one of the interviewers even told me that I didn't belo-

Wow! I cannot believe that ELIZA goes beyond the code and dives right for the soul.

Gone are the days where you handed your code to a wizard during code review to be told you forgot a space after the if keyword.
Instead, you can ignore your coworkers and speak to the compiler all day.

* Is there anything wrong with my formatting?

> What does that suggest to you? 

* I just get a little bit obsessive about code formatting

> That is an interesting response. Let me make anote of that for next time. 

* You forgot a space between "a" and "note"

> Oh... Let's move on to something else for a bit.  forgot a space between" a" and" note"?

Compiler bug? No! ELIZA exhibits human traits and makes mistakes just like the rest of us.

Timeline

Given enough community support and interest, I would love to get this implemented a year from today (April 1st, 2021). Please let us know your level of interest to see if we can prioritize this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This RFC proposes integrating ELIZA into the TypeScript compiler but names no files, tests, or implementation entry points. Start by reviewing the proposal and its requested community support; no concrete completion criteria or actionable code path are provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.