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

Add note about TypeScript requiring types for namespaced attributes #954

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

titoBouzout
Copy link
Collaborator

  • [x ] I have read the Contribution guide
  • This PR references an issue (except for typos, broken links, or other minor problems)

Description(required)

Someone made a note on discord that for example prop:scrollTop gives a type error, and asked if that was a bug. Related docs page https://docs.solidjs.com/reference/jsx-attributes/prop

I understood the expectation, given that there is no indication that the typings for such a prop must be provided by the user. I understand we do not want to include types on each page and have a special page for types instead. So I'm including a note on each special namespaced attributes page indicating that the types must be provided and linking to the examples given in the TypeScript page

I'm not that sure about the format of the note as in "Note: text", or could be a callout but maybe It's too much, maybe we can bold the "Note" part?

Related issues & labels

  • Closes #
  • Suggested label(s) (optional):

Copy link

stackblitz bot commented Nov 14, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit 51d6bcd
🔍 Latest deploy log https://app.netlify.com/sites/solid-docs/deploys/674539464019620008550ae9
😎 Deploy Preview https://deploy-preview-954--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@atilafassina atilafassina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nits about using the built components for highlighting/callout

@@ -19,3 +19,5 @@ This attribute is most useful for Web Components.
<my-element />

```

Note: Type definitions are required when using TypeScript. See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the Callout component

<Callout type="info" title="Strong-Typing Custom Properties">...</Callout>

@@ -8,3 +8,5 @@ Forces the prop to be treated as a property instead of an attribute.
```tsx
<div prop:scrollTop={props.scrollPos + "px"} />
```

Note: Type definitions are required when using TypeScript. See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the Callout component

<Callout type="info" title="Strong-Typing Custom Properties">...</Callout>

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