Top "Type-assertion" questions

A type assertion is like a type cast, but performs no special checking or restructuring of data.

Does a type assertion / type switch have bad performance / is slow in Go?

How slow is using type assertions / type switches in Go, as a method of run-time type discovery? I've heard that …

casting go type-conversion type-assertion
Learning TypeScript - Casting Types

I'm new to TypeScript and I'm playing around with the various language features. Below is a code sample I've been …

typescript inheritance type-assertion
Can I type assert a slice of interface values?

I am trying to type assert from a []Node, to []Symbol. In my code, Symbol implements the Node interface. Here …

interface type-conversion go type-assertion
Passing in a type variable into function

I'm trying to achieve a type assertion by passing in a type into a function. In other words, I'm trying …

go type-conversion type-assertion
How to iterate over an []interface{} in Go

I'm struggling to get the keys and values of the following interface, which is the result of JSON marshaling the …

go interface type-assertion
What is the meaning of "dot parenthesis" syntax?

I am studying a sample Go application that stores data in mongodb. The code at this line (https://github.com/…

go syntax type-assertion language-concepts
How to log type assertion errors in golang?

I have an array of some data which I want to map in []string. I can do it in 2 ways: …

go error-handling type-assertion
invalid operation: type interface {} does not support indexing

I'm new to the golang and I have problem while reading the nested JSON response. var d interface{} json.NewDecoder(…

json dictionary go unmarshalling type-assertion
What does the "as const" mean in TypeScript and what is its use case?

I am confused about the as const cast. I checked a few documents and videos but did not understand it …

typescript type-assertion