Skip to content

ts-style ignore or any for flexibility #1054

@hunterloftis

Description

@hunterloftis

I've just completed converting several thousand lines of lua to teal for two projects. I'm having to revert that change in one project, though, because teal has no mechanism to either:

  1. ignore lines/files/blocks or
  2. treat any as a flexible "could-be-anything", ala TypeScript

This means that using a 3rd-party lua module without teal types is impossible. You can require the module via a *.d.tl hack like:

local primitives: any
return primitives

...but then every single use will error because, unlike TS, Teal treats any as closed, rather than open:

cannot index key 'square' in variable 'primitives' of type <any type>

So unless you're willing to build types for literally everything you pull in, which is often infeasible, there's just no way to have forward progress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requestsemanticsUnexpected or unsound behaviors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions