Category "typing"

Create a global function like jest does

I am working on a meta framework that will use react. I would like to offer some functions that are directly available without the need of an import, exactly li

Mypy Function "lxml.etree.ElementTree" is not valid as a type but why?

I am using Mypy for this function import funcy as fu from lxml import etree from lxml.etree import Element, ElementTree def find_nodes(tree: ElementTree, paths

Check if string is in string literal type

We use static type checking extensively, but we also need some simple runtime type checking. I'd love to use our static types for that runtime type checking. I'

How to specify that a python object must be two types at once

I'm using the Python typing module throughout my project, and I was wondering if there was a way to specify that a given object must be of two different types,

Python Typing: Subtype Literal

In Python, I would like to "narrow-down", or "sub-type" a Literal: I would like to have two Literal type aliases, Parent and Child, and I would like to assure t

Only allow specific components as children in React and Typescript

I would like to only allow specific components as children. For example, let's say I have a Menu component, that should only contain MenuItem as children, like

Typing variables in Common Lisp

I read that CL supports optional typing (as in the language has this feature) which I would assume allos for faster code in many cases, but I can't seem to find

Use generic in type alias

My type annotations I currently have look similar to the following, and I want to use an typing alias to not repeat myself so much: A class has class variables,

Is there a way to "extract" the type of TypeScript interface property?

Let's suppose there's a typing file for library X which includes some interfaces. interface I1 { x: any; } interface I2 { y: { a: I1,

How can I type annotate a PyMongo Collection?

I'm currently using: from typing import Type from pymongo.collection import Collection def collection_type_test(example_collection: Type[Collection]) -> lis