Type annotations for a Model

Hello
Is it possible to annotate that a variable is of type certain Model existing in the workspace?
(similar to the annotations to a certain built-in class like Player, RopeConstraint, etc.)

Thanks in advance

1 Like

Not that I know of, however you can get pretty close but manually defining a new type, manually defining each child and descendant and so on. It will take a while and I would recommend just adding the crucial items to the type.

If there’s a particular model you want a type for, please respond with an image of it in the explorer and I can try to make a type


edit: the mechanism needed is called type intersection, as the below post says.

4 Likes

You could also take advantage of type intersection.

For example, the “typed-character pattern” (which I just named):

type Character = {
    Humanoid: Humanoid,
    HumanoidRootPart: Part
} & Model
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.