Giter VIP home page Giter VIP logo

Comments (5)

ecraig12345 avatar ecraig12345 commented on July 19, 2024 1

It's considered good practice (at least on the team that wrote this material) to specify the types of function parameters even if they could potentially be inferred. In our main codebase, we actually have a lint rule enforcing that function parameters have types. So I think the code should stay as-is.

from frontend-bootcamp.

ecraig12345 avatar ecraig12345 commented on July 19, 2024 1

Looked at this more and my last comment was slightly incorrect--we actually use a TypeScript compiler option noImplicitAny so that the compiler will give an error when the type of a parameter isn't specified. That's what would give an error if we removed the type here.

What I meant by "lint" is that our team uses a tool called tslint to help enforce good coding practices in TypeScript code. If someone writes code that violates a lint rule, it will show an error when they build the code. There are similar lint tools for other languages.

from frontend-bootcamp.

ecraig12345 avatar ecraig12345 commented on July 19, 2024

Would you mind explaining what you mean in more detail?

from frontend-bootcamp.

lubegasimon avatar lubegasimon commented on July 19, 2024

i mean since you have this,
class TodoHeader extends React.Component<**TodoHeaderProps**, TodoHeaderState> {
, then this is okay this way,
constructor(props: `TodoHeaderProps ) {

from frontend-bootcamp.

lubegasimon avatar lubegasimon commented on July 19, 2024

It's considered good practice (at least on the team that wrote this material) to specify the types of function parameters even if they could potentially be inferred. In our main codebase, we actually have a lint rule enforcing that function parameters have types. So I think the code should stay as-is.

could you please tell me that lint rule?

from frontend-bootcamp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.