Questions tagged [types]
Types, and type systems, are used to enforce levels of abstraction in programs.
types
28,914
questions
0
votes
1
answer
20
views
Rust generic lifetime elision issue
I am trying to a implement generic observable collections for use with a UI framework I'm writing. I'm currently having an issue with lifetimes not being elidable in generics.
For brevity the ...
0
votes
0
answers
23
views
Creating a type from an object's keys and values in TypeScript
I'm trying to create a new type based on the type of a statically defined object in TypeScript. Given the following map:
const map = {
'hello': {a: 1, b: false},
'world': {b: 'hello', c: null}
...
3
votes
1
answer
30
views
Typescript: Variable inside Express RequestHandler becomes possibly undefined despite being checked in an if statement [duplicate]
I am creating a way to dynamically create routes before the server fully starts (meaning I'm not creating a route via a request lol that would be crazy), and I stumbled upon this interesting quirk.
...
1
vote
1
answer
21
views
Why does Typescript loses inference on nested objects when accessing them with dynamic property names?
Playground: https://tsplay.dev/m3Gqqm
I'm trying to access deeply nested properties of my theme object based on input parameters, so I can provide a nice dev experience by having autocomplete.
But ...
0
votes
1
answer
61
views
Get templated struct without knowing initial template arguments
I am looking for a way to get a specified templated struct from the custom Node classes I am building without having to static_cast or dynamic_cast when I get the pointers. What ways can I use to ...
0
votes
1
answer
16
views
Pydantic union discriminator not being used for FastAPI response
I have the following Pydantic models:
class Activity(BaseModel):
activity_key: ActivityKey
activity_id: UUID = Field(default_factory=uuid4)
questions: list[QuestionWithDistractors] | list[...
2
votes
2
answers
52
views
How to convert data frame in R to a "character" data type?
The labeller function which I'm using for ggplot requires data of the type:
tempdat <- c(
"1" = "one",
"2" = "two"
)
If I use typeof(tempdat) it gives ...
0
votes
1
answer
19
views
How to fix: Property 'geocodeService' does not exist on type 'typeof import("node_modules/@types/esri-leaflet-geocoder/index")'
I'm having a typing issue with the Esri Leaflet Geocoder types package. https://www.npmjs.com/package/@types/esri-leaflet-geocoder
Here is how I'm importing it:
import * as L from 'leaflet';
import '...
0
votes
0
answers
19
views
Problem with the error message displayed in a form
I would like the user to take into account in the form that the numbers are entered with periods and not with commas and I have a problem: the error message is displayed when entering a decimal number ...
0
votes
0
answers
34
views
Cannot map the input column, 'Date', to the lookup column, 'Date', because the data types do not match
I'm getting this error:
TITLE: Microsoft Visual Studio
Cannot map the input column, 'Date', to the lookup column, 'Date', because the data types do not match.
Data type in SSMS
Changed type to date, ...
-1
votes
1
answer
53
views
Picked structs in rust
Is it possible to have a picked struct in such a way that the type checker doesn't have a problem with it?
Coming from TypeScript:
// Considering a main object type containing all fields:
interface ...
-1
votes
2
answers
88
views
uint8_t elements exceeding one byte?
I saw this code:
uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
I know uint8_t holds a byte, so how does this line of code work when a single
element, 0xFF, is in itself one whole ...
0
votes
0
answers
22
views
R visNetwork arrow type
The below code is meant to yield the following network graph:
.
library(visNetwork)
library(magrittr)
nodes <- data.frame(id=c("a","b","c","d"), label=c(&...
1
vote
3
answers
101
views
In C, why can a variable holding a char array be assigned to a pointer, but the address of the same pointer cannot?
Consider the following code:
char stringy[] = "There's too much confusion, I can't get no relief!";
char *pStringy;
pStringy = stringy;
This compiles -
stringy is an array of characters, ...
0
votes
1
answer
134
views
Write a new Delphi type that lets a method have inline code as a parameter?
Is it possible to have this in Delphi?
DoThis(ShowMessage('SomeMsg ..'); Caption := 'SomeCaption'; Inc(I));
Is it possible to create a new type that handles inline code like this?
For example, we ...