#824·codon

Cannot import TYPE_CHECKING from `typing` / TYPE_CHECKING not ignored

Author: 1998marcom-nelsonCreated Jun 11, 2026Updated Jun 11, 2026

Python static analysis fails on some codon-specific code (i.e. u32, u64 used as types). An handy solution could be including for the type checkers a small section where necessary, like:

from typing import TYPE_CHECKING
if TYPE_CHECKING:
    u64 = int
    u32 = int

This should allow standard type checkers and static analysis to work decently with codon.

As of now, the above code results in the compilation error:

error: cannot import name 'TYPE_CHECKING' from 'typing'

A simple fix, I believe, would be adding TYPE_CHECKING = False in typing

EDIT: I am not sure the codon compiler skips entirely a block that is 100% sure not to be executed. If that's not the case, it might not be as easy :')