Category "types"

How to specify python type hints for complex package as opencv or tensorflow?

I am building a python library and I writing a function like this: def addimg(image) -> None: now I want to specify the type of image as an OpenCV image (e.

Correctly declare interface or type for functions params

How to correctly declare type for param cardsByStatus inside function addCardsToStatus? It works for cardsByStatus: any, but it doesn't make sense for me. Error

Define an empty object type in TypeScript

I'm looking for ways to define an empty object type that can't hold any values. type EmptyObject = {} const MyObject: EmptyObject = { thisShouldNotWork: {},

error TS2322: Type 'Event' is not assignable to type 'string'. [(ngModel)]="todoItem" (keyup) ="addTodo()"

I'm trying to bind my input to be able to display string. But I've this error: Error: list.component.html:3:15 - error TS2322: Type 'Event' is not assignable to

Defining new types in Haskell

I am pretty new to Haskell, and I was wondering if one can define new types that are defined by lists of other types. For example, I assume a string is defined

Append to existing tuple in c++

i am trying to make a thing to store types in list. The best thing is to use a tuple. then to get the type i use tuple_element_t. But the problem is when append

Python type hint for (any) class

I want to type hint the following function: def get_obj_class(self) -> CLASS_TYPE: return self.o.__class__ CLASS_TYPE should denote classes. self.o could

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

Long return type hint and pep8

I have a function that raises an E501 line too long (86 > 79 characters) warning when running pycodestyle. def my_function(arg1: list = None) -> Tuple[pd.

make .d.ts for external library file available for project

I have a closed-source plain JS library that will be included via a <script> tag pointing to a CDN. I would like to author my own type definition file for

How to omit an union type depending on field value

I have this type (come from third party library): type StackActionType = { type: 'REPLACE'; payload: { name: string; key?: string | unde

How to include a global file type declaration in a TypeScript (Node.js) package

I'm working on a package that I am planning to publish publicly on npmjs. Let's call it the "text package". I would like that by default when installing that pa

Checking equality of interface{}

I am searching a []interface{} slice for a given interface{} value: var v interface{} for i := 0; i < len(A); i++ { if (A[i] == v) { fmt.Println("Gotc

Slick using mapped column type in update statement

I have a trouble in using slick MappedColumnType, the code snippet is as following: private trait UserTable { self: HasDatabaseConfigProvider[JdbcProfile] =&

React Three Fiber OBJLoader conflicts witth @types/three

I am following the official React Three Fiber Docs here. I am trying to load .obj files into my scene, using this article: react-three-fiber docs: loading obj m

How do I idiomatically convert a bool to an Option or Result in Rust?

It seems there is no way of such one-line conversion using std. I do not like this kind of verbosity: match my_bool { true => Ok(()), false => Err

How can I define a type for a css color in TypeScript?

I have the following example code snippet: type Color = string; interface Props { color: Color; text: string; } function Badge(props: Props) { re

Entity Framework : Value cannot be null. Parameter name: type

When I execute update-database command, it shows this error message System.ArgumentNullException: Value cannot be null. Parameter name: type at Sy

Typescript input onchange event.target.value

In my react and typescript app, I use: onChange={(e) => data.motto = (e.target as any).value} How do I correctly define the typings for the class, so I woul

How to use spark with large decimal numbers?

My database has numeric value, which is up to 256-bit unsigned integer. However, spark's decimalType has a limit of Decimal(38,18). When I try to do calculatio