angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.72k forks source link

Prefix all interfaces/types with `Mat` #9587

Open rafaelss95 opened 6 years ago

rafaelss95 commented 6 years ago

Bug, feature request, or proposal:

Maybe a proposal.

What is the expected behavior?

I'd expect all interfaces/types to have the Mat prefix for consistency.

What is the current behavior?

Not sure if it was intentional, but there are some interfaces/types that aren't prefixed by Mat.

Ex.:

https://github.com/angular/material2/blob/a5ca9ceec6cc3bcd4ad0e9f44a63ef5ed2c2144e/src/lib/button-toggle/button-toggle.ts#L34

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

5x.

Is there anything else we should know?

You should already know this, but anyway to find all interfaces/types that aren't prefixed by Mat, you can search using the following regex export (interface|type) [^M].

crisbeto commented 6 years ago

I'm not sure whether this is necessary. Whoever is importing the symbol can figure out that it's from Material by seeing that it comes from @angular/material/*.

pjmagee commented 6 years ago

I guess an argument would be that most people would type MatToggleType or read markup with angular code and know the types are specifically based around Material Design. Another good reason for prefixing is less clashing? Also, if many are already prefixed, than doesn't that mean a small percentage that aren't prefixed are essentially going against an implicit or unspoken conventional coding style for this project? (Personally, I don't mind - but i understand the issue raised does serve a purpose for discussion)

alexciesielski commented 6 years ago

I let VS Code auto import all of my classes, so I just got used to typing Mat..... and hitting Enter. This is much faster than scrolling to the top, typing import ..... and looking for the class I need.

So I vote in favor of this change.

angular-robot[bot] commented 2 years ago

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] commented 2 years ago

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.