question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable strict typing

See original GitHub issue

Problem

Having types and type checks helps to:

  • Check that all functions exist and called with correct arguments.
  • Make the code more robust.
  • Allow to refactor code simpler and safer.

The plan

I’ll enable mypy checks soon and will gradually enable stricter checks as more parts are covered with types.

Let me know what do you think!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
KapJIcommented, Mar 12, 2021

As I mentioned in the description, having type hints helps to make sure you’re passing arguments with the correct types and this helps to avoid mistakes.

1reaction
KapJIcommented, Apr 2, 2021

Yes, few things.

  1. Add homeassistant-stubs. I already created the package. Waiting for the release of homeassistant 2021.4.0 next Wednesday. It includes few changes I have added to be able to properly type check the component (https://github.com/home-assistant/core/pull/48421, https://github.com/home-assistant/core/pull/48450). I can probably start using beta version in the meantime.
  2. Annotate config_flow. This depends on 1.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Strict Typing Mode in PHP - BrainBell
In PHP the declare(strict_types = 1); directive enables strict mode. In strict mode, only a variable of the exact type of the “type...
Read more >
Use declare(strict_types=1) to enable strict mode for type ...
PHP reminder: The "declare(strict_types = 1);" directive enables strict mode. In strict mode, only a variable of exact type of the “type declaration”...
Read more >
strict - TSConfig Option - TypeScript
How to provide a type shape to JavaScript objects. Narrowing. How TypeScript infers types based on runtime behavior. Variable Declarations.
Read more >
TypeScript strictly typed: strict mode is not enough - Medium
typescript-strictly-typed enables configurations for strictly typed TypeScript, ESLint or TSLint, and optionally Angular.
Read more >
PHP strict_types - PHP Tutorial
Summary: in this tutorial, you'll learn how to enable strict typing using the PHP strict_types directive. Introduction to the PHP strict typing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found