tutorialkit icon indicating copy to clipboard operation
tutorialkit copied to clipboard

Can't get typescript auto complete to work on ts and tsx files

Open noam-honig opened this issue 1 year ago • 4 comments

Describe the bug

I'm writing a tutorial that uses typescript, and I can't get typescript auto complete to work on the code editor (and also typecheck)

Link to a StackBlitz project which shows the error

No response

Steps to reproduce

Here's my repo: https://github.com/noam-honig/play-with-tutorial-kit/tree/typescript-typing

I use a vite typescript project for the template.

I added a file: src\content\tutorial\1-basics\1-introduction\1-welcome_files\test.ts

type Person = {
  firstName: string;
  lastName: string;
};

export function test() {
  var p: Person = {
    // try typing firstName / lastName - I don't get any typing errors
  };

  alert(p.firstName + " " + p.lastName);
}

When I try to type firstName inside the new object, it doesn't auto complete, nor does it type check that I spelled it correctly.

image

Expected behavior

I expect auto complete to display firstName and lastName, and if I type a wrong value, to get some error highlighting as I do in stackblitz Screenshot from stackblitz image

Screenshots

No response

Platform

  • TutorialKit version: 0.1.2
  • OS: windows
  • Browser: chrome
  • Version: [e.g. 91.1]

Additional context

No response

noam-honig avatar Aug 05 '24 05:08 noam-honig

Currently the code editor does not have type aware intellisense. However this is something we are planning to improve in future.

AriPerkkio avatar Aug 05 '24 05:08 AriPerkkio

@AriPerkkio thanks for getting back to me, I see that in the angular tutorial it seems to work (at least partially) https://angular.dev/tutorials/learn-angular

Is this a different engine?

noam-honig avatar Aug 05 '24 12:08 noam-honig

Is this a different engine?

Looks like Angular's tutorial is using the same editor (CodeMirror) that TutorialKit uses. This simply hasn't been implemented on TutorialKit's side.

AriPerkkio avatar Aug 06 '24 06:08 AriPerkkio

Hi Guys,

Just saying that this is my top priority feature - my tutorial (learn.remult.dev) is in typescript, and remult takes full advantage of typescript - but without the editor support, its missing the point a little.

So just in case you were wondering what's a priority for me - this is the one :)

Thanks

noam-honig avatar Aug 18 '24 17:08 noam-honig