vuejs / docs

📄 Documentation for Vue 3
https://vuejs.org
Other
2.86k stars 4.24k forks source link

Props declaration intro example uses non-recommended style #2921

Closed nielsbom closed 2 days ago

nielsbom commented 2 weeks ago

The docs on props declaration start with this example:

defineProps(['foo'])

and then a little later show

defineProps({
  title: String,
  likes: Number
})

The Essential Rules say to only use the first style when prototyping.

I think it's better to show the recommended style first and then later in the page show that a short style is also technically possible, but recommended against. I think most people read and apply docs until they sort of get what they need, and then stop reading. The (current) first form will (obviously) work but will teach them bad form and give them problems later.

Shall we change the ordering and add a bit of prose around it?

AloisSeckar commented 2 weeks ago

AFAIK style guide is currently considered obsolete, as it wasn't properly reviewed for Vue 3. There is no direct link to it from the menu, it is commented out.

And btw. I don't think this rule is good at all, as it essentialy enforces using TypeScript, which shouldn't be mandatory for adopting Vue (although I personally cannot imagine not to develop modern webapps without it - but it is an extra level of complexity for newcommers).

NataliaTepluhina commented 2 days ago

The docs go from "simplest" to "most complicated" explanation. While a style guide is important, it's not enforced, so we will keep the current explanation for now.

nielsbom commented 2 days ago

as it essentialy enforces using TypeScript

I don't think it does actually.