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

Typescript typings #1053

Merged
merged 4 commits into from
Sep 3, 2023
Merged

Typescript typings #1053

merged 4 commits into from
Sep 3, 2023

Conversation

gaurishhs
Copy link
Contributor

@gaurishhs gaurishhs commented Aug 21, 2023

From: #1052

Please suggest changes (if any)
All this has been taken from the documentation.

@cossssmin
Copy link
Member

Thanks! Can we start with fixing the linting issues please? 😇

@gaurishhs
Copy link
Contributor Author

How do you enable intellisense for these issues? I do have the ESLint extension installed

@cossssmin
Copy link
Member

We’re using XO, you’ll need the linter plugin, here it is for VS Code:

https://github.com/xojs/vscode-linter-xo

@gaurishhs
Copy link
Contributor Author

i guess we're ready to go now.

@gaurishhs
Copy link
Contributor Author

hi @cossssmin any updates?

@cossssmin
Copy link
Member

Hey, sorry for the delay, I've been a little busy with life offline but I'll try to go through it this week. Thanks 🙏

@cossssmin
Copy link
Member

Getting the same error for both imports:

image

And for example prettify doesn't show any suggestions:

image

markdown is missing from the Config interface (it's only defined for the method in the RenderOptions, but I can add that no worries.

@cossssmin
Copy link
Member

cossssmin commented Sep 1, 2023

Actually on the markdown note, if I do this:

interface MarkdownConfig {
  root?: string;
  encoding?: string;
  markdownit?: Options;
  plugins?: [];
}

Then add it to the Config interface:

interface Config {
  markdown?: MarkdownConfig;
}

... I'm not seeing it autocomplete/suggested when doing Ctrl+Space?

I'm sorry, I have no experience with TS this is all new to me.

@cossssmin
Copy link
Member

Nevermind, need to import the correct interface, going through it now 👍

/** @type {import('@maizzle/framework').Config} */

@gaurishhs
Copy link
Contributor Author

yeah, you were importing the whole module instead of the interface. I made sure to have the same interface name as tailwind's.

@cossssmin
Copy link
Member

cossssmin commented Sep 3, 2023

Working on adding JSDoc to everything so you can see a short description in the suggestions dropdown or when hovering over a key. What do you think of using @defaultValue like this, to let the user know what the default is in Maizzle?

interface LayoutsConfig {
  /**
   * Name of the fill tag, where the content will be injected.
   * This is typically used in a Template file, to extend a Layout.
   * @defaultValue `'block'`
   */
  fillTagName?: string;
}

Looks like this:

image

@gaurishhs
Copy link
Contributor Author

gaurishhs commented Sep 3, 2023 via email

@cossssmin
Copy link
Member

I really like that you can 'read the docs' right in the editor this way, looks pretty good and I'm OK with added maintenance because it adds value to the user.

image

Also, thanks for the pointer about @default 👍

add new types, add jsdoc, fix typos
@cossssmin
Copy link
Member

Made some changes:

  • added new types (i.e. for query-string)
  • created some new intefaces for config types
  • added JSDoc so the IDE shows a description and defaults/examples

The file is pretty big now so I'm thinking of splitting it up into multiple files, what do you think? We can release v4.6.0 as it is now, we can refactor/split it later.

@gaurishhs
Copy link
Contributor Author

gaurishhs commented Sep 3, 2023 via email

@cossssmin
Copy link
Member

Cool, merging and will release v4.6.0 tomorrow. Thank you for your contribution!

@cossssmin cossssmin merged commit 0000a29 into maizzle:master Sep 3, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants