Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Typescript examples are faulty or missing #4395

Open
schlenger opened this issue Jul 27, 2021 · 7 comments
Open

Docs: Typescript examples are faulty or missing #4395

schlenger opened this issue Jul 27, 2021 · 7 comments

Comments

@schlenger
Copy link

schlenger commented Jul 27, 2021

Problem
I tried to setup a sample project by reading the docs and stumbled upon some missing dependencies and wrongly formatted code which is hard to fix if someone tries to implement the initial setup as a beginner.

Solution
The sections in https://docs.slatejs.org/walkthroughs/01-installing-slate as well as https://docs.slatejs.org/concepts/12-typescript need formatting updates as well as a check if things work if you stick to the documentation.

Context
I can take care of this, if it is helpful.

@schlenger
Copy link
Author

Sidenote: When implementing https://docs.slatejs.org/walkthroughs/05-executing-commands in TS, there is an issue, that bold is used for spans in prior and in this example for the complete blocks

@ghost
Copy link

ghost commented Aug 3, 2021

I found the docs hard to follow too when using TS. The best solution would be to split every page into two separate JS and TS sections.

@Andrewnt219
Copy link

@ilovecommits In the 01-installing-slate, the TypeScript code for setting up the component has a compilation error. CustomElement should be an array.

// Correct version
const App = () => {
  const initialValue: CustomElement[] = []
  //...
}

image

@ghost
Copy link

ghost commented Aug 24, 2021

@ilovecommits In the 01-installing-slate, the TypeScript code for setting up the component has a compilation error. CustomElement should be an array.

// Correct version
const App = () => {
  const initialValue: CustomElement[] = []
  //...
}

image

Not sure why you tagged me, but just submit a PR.

@TrySpace
Copy link

TrySpace commented Jan 7, 2022

Same, getting:

Subsequent property declarations must have the same type.  Property 'Element' must be of type 'CustomElement', but here has type 'CustomElement'.

When trying the first example

@BrentFarese
Copy link
Collaborator

Sidenote: When implementing https://docs.slatejs.org/walkthroughs/05-executing-commands in TS, there is an issue, that bold is used for spans in prior and in this example for the complete blocks

@TrySpace were you able to resolve this? I am getting a similar error in my codebase.

@maral
Copy link

maral commented Mar 13, 2024

In 2024 I came here to complain about this, once again. It would be really nice to be able to understand which types I should use for all the different use cases, instead of putting any or @ts-ignore everywhere so the code even compiles...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants