Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

types
0 votes
0 answers
32 views

exported variables always return undefined in discord.JS V14

in events/messageCache.ts: import { Events, Message } from 'discord.js'; export interface MessageCacheEntery { authorID: string; deleted: boolean; message: string; timestamp: number; }...
Jaco's user avatar
  • 11
1 vote
1 answer
32 views

Extract Generic Interface or Type keys as an Array [duplicate]

I want to know if it's possible to get a generic interface or type and get it's properties like an array of objects, like this: interface UserData { email: string } keys = extractKeys<UserData&...
João Pedro's user avatar
-2 votes
0 answers
38 views

Returning an array of raw type but instead of an array of parameterized type specified at the header

protected Collection<Node> createBucket() { return new LinkedList<>(); } /** * Returns a table to back our hash table. As per the comment * above, this table can be an array of ...
Pius's user avatar
  • 1
0 votes
0 answers
39 views

Joda-time type mapping in Hibernate ORM 6

I'm new to Java and I am trying to migrate from Hibernate 5 to 6. My application uses joda-time for the timestamp data type. It is using both annotation and hibernate mapping files. Following is a ...
tieuquynd's user avatar
0 votes
1 answer
50 views

Dynamically set the Property name to be the name of the Type(typeof(T).Name)

var appsettings = JsonConvert.DeserializeObject<AppSettings<PersonModel>>(configData); class AppSettings<T> { [JsonProperty(PropertyName = typeof(T).Name)] public T ...
Imran K's user avatar
  • 15
2 votes
1 answer
44 views

Casting RDD to a different type (from float64 to double)

I have a code like below, which uses pyspark. test_truth_value = RDD. test_predictor_rdd = RDD. valuesAndPred = test_truth_value.zip(lasso_model.predict(test_predictor_rdd)).map(lambda x: ((x[0]), (x[...
Inkyu Kim's user avatar
  • 145
1 vote
0 answers
30 views

When using WC_Product_Variable, it creates a simple product [duplicate]

I am trying to progmatticly create a Variable Product in WooCommerce like so: $currentProduct = new WC_Product_Variable(); $currentProduct->set_name( $product['Title'] ); ...
francis astin's user avatar
0 votes
2 answers
62 views

TypeScript Type narrowing not working for collection schema

I'm working on an Astro + TypeScript project where I have few data collections with specific schemas. I'm using the Zod library to define and structure each data collection, which in a simplified way ...
Mauricio Esparza's user avatar
0 votes
1 answer
39 views

Is it possible to annotate the type of a Svelte component?

I have several Svelte components, for example: Melon.svelte, Cherry.svelte, Phone.svelte. In a parent component, FruitBox.svelte, using <svelte:component>, I want to be able to dynamically ...
goose_lake's user avatar
  • 1,272
1 vote
1 answer
37 views

PowerShell - cast a variable type based on a variable definition

I've got a hashtable with variables. The source of this hashtable is an empty parameters.json (for deployment of Azure resources) converted to a hashtable. For this question I have simplified this ...
TheBrickAdmin's user avatar
1 vote
1 answer
37 views

why can't typescript figure out that the possible actual types of a union type correspond to the available prototypes for a function? Workaround?

This (playground link) doesn't work: type ReplaceAll2ndArgType = string | ((substring: string, ...args: unknown[]) => string) export async function renderHTMLTemplate( args: Record<string, ...
Britton Kerin's user avatar
0 votes
1 answer
35 views

Why is the type {} inferred instead of unknown when strictNullChecks is disabled?

Consider the following code: const { name } = "something" as unknown; When I enable Typescript's strictNullChecks, I get the following error message: Error: Property `name` does not exist ...
Jonas's user avatar
  • 13
0 votes
1 answer
27 views

Getting object name limited to values defined in Set in TypeScript

I have some Set, which defines some IDs: export const IDS: Set<number> = new Set<number>([1, 30, 50, 9999]); Now I'd like to define mapping for their ID-SHA pairs in object structure: ...
Tomas's user avatar
  • 3,388
0 votes
1 answer
50 views

TypeScript types - accessing function's argumets Tuple type from function call (Fn type generated by another type)

Edit: I completely changed question after playing with this a little today: Playground I start from the end, with example that for sake of simplicity wants to get a correct first argument user ...
Jarek's user avatar
  • 7,673
0 votes
3 answers
82 views

Can a Go interface receive any function, regardless of its signature?

EDIT: A couple of the answers have suggested changing the signature of the RegisterHandler function, however as part of the original question I asked if it were possible to further restict the types, ...
Masa Maeda's user avatar

15 30 50 per page