typeof Questions

6

Solved

Is typeof in C, really an operator? I'm thinking because there is no polymorphism in C, that there is nothing to do at run-time. That is, the answer to typeof is known at compile-time. (I can't thi...
Epinephrine asked 22/8, 2012 at 21:12

12

Solved

If I have: void MyMethod(Object obj) { ... } How can I cast obj to what its actual type is?
Clein asked 2/9, 2012 at 7:18

4

Solved

I'm quite new to the front end - trying to implement client side on React. After adding "react-native" dependency and running webpack I'm getting the following error: ERROR in ./node_modules/react...
Diamagnetic asked 4/4, 2020 at 22:51

16

Solved

I've seen many people use the following code: Type t = typeof(SomeType); if (t == typeof(int)) // Some code here But I know you could also do this: if (obj1.GetType() == typeof(int)) // Some cod...
Carp asked 11/6, 2009 at 19:10

8

Solved

We can use a C# typeof keyword when we want to get Type instance for specified type. But what can I use if I want to get MethodInfo of a method by it's reference? For example I have a simple cons...
Lineup asked 21/2, 2012 at 17:30

27

Solved

In my particular case: callback instanceof Function or typeof callback == "function" does it even matter, what's the difference? Additional Resource: JavaScript-Garden typeof vs instanceof...
Subsistence asked 22/5, 2009 at 19:24

6

Solved

I have the following code: return "[Inserted new " + typeof(T).ToString() + "]"; But typeof(T).ToString() returns the full name including namespace Is there anyway to just get the class nam...
Talbot asked 3/8, 2010 at 12:12

7

Solved

In R, I'd like to retrieve a list of global variables at the end of my script and iterate over them. Here is my code #declare a few sample variables a<-10 b<-"Hello world" c<-data.frame()...
Chadd asked 2/10, 2012 at 15:57

5

In the following code, copyThing() is written so that its return value has the same type as its argument value: extern void *copyThingImpl(const void *x); #define copyThing(x) ((typeof(x)) copyThi...
Grane asked 15/8, 2023 at 15:23

15

Solved

Is there any way to efficiently check if the variable is Object or Array, in NodeJS & V8? I'm writing a Model for MongoDB and NodeJS, and to traverse the object tree I need to know if the obj...
Papyrus asked 12/1, 2012 at 11:12

4

Solved

const names = ['jacob', 'master jung', 'kyuhyun'] as const; type Names = typeof names[number]; I got the results I wanted, but I don't understand typeof names[number]. What does typeof Array[n...
Koal asked 31/12, 2019 at 8:25

9

Solved

I had a perception that, type of a lambda is a function pointer. When I performed following test, I found it to be wrong (demo). #define LAMBDA [] (int i) -> long { return 0; } int main () { lo...
Skewness asked 31/10, 2011 at 8:36

7

Solved

I am wondering what the difference is between typeid and typeof in C++. Here's what I know: typeid is mentioned in the documentation for type_info which is defined in the C++ header file typeinfo...
Caucasoid asked 31/12, 2009 at 17:55

6

Solved

I have a function I need to pass an object to. I use typeof operator to make a check before processing. But looking at this link, it appears that many javascript instances, such as array or regex, ...
Holzer asked 26/7, 2019 at 21:24

25

Solved

Why is null considered an object in JavaScript? Is checking if ( object == null ) Do something the same as if ( !object ) Do something ? And also: What is the difference between null a...
Bonnet asked 29/4, 2009 at 5:47

3

Solved

I would like to declare a type-enforced array of items and be able to derive a union type from it. This pattern works if you do not explicitly give a type to the items in the array. I am not sure h...
Sierra asked 2/3, 2020 at 20:37

10

Solved

Transpiling via gulp-babel for the server and browserify with babelify for the client - using async and await in my code. These features seem to transform just fine, but... Error: Cannot find modul...
Noellenoellyn asked 16/12, 2015 at 20:32

10

Solved

So i have a function that needs to check if an argument is an object, but this fails because: typeof [] // returns 'object' This is a classic javascript gotcha, but i cant remember what to do to...
Sensationalism asked 15/2, 2010 at 12:38

11

Solved

In C++, how does one find the type of a variable?
Ruyle asked 3/7, 2012 at 12:27

25

Solved

For example: int a = 12; cout << typeof(a) << endl; Expected output: int
Breakfront asked 17/9, 2008 at 10:34

8

Solved

What's it used for if it always returns object as type? always for Elements or lists.
Lanthorn asked 24/9, 2010 at 14:13

4

Solved

I have exported a function from some module that looks like: export function MyFunc<A>() { return { foo: (in: A) => void } } Now, in some other module, I want to be able to talk abou...
Deutero asked 24/10, 2018 at 7:55

6

Is there any way that I can discover the type of a variable automatically in C, either through some mechanism within the program itself, or--more likely--through a pre-compilation script that uses ...
Overpraise asked 6/2, 2012 at 6:13

1

So from: export interface Category{ val: string; icon: string } const categoryArray: Category[] = [ { val: 'business', icon: 'store' }, { val: 'media', icon: 'video' }, { val: 'people',...
Wes asked 13/1, 2022 at 13:56

14

Solved

Is there a better way to get the type of a variable in JS than typeof? It works fine when you do: > typeof 1 "number" > typeof "hello" "string" But it's useless when you try: > typeof ...
Bedrail asked 12/9, 2011 at 15:39

© 2022 - 2025 — McMap. All rights reserved.