All Questions
Tagged with types type-conversion
575
questions
-2
votes
2
answers
94
views
Custom integer-like datatype with support for static casts without warnings
I'm writing my own little utility library, and I've opted to do something which I don't really see often (and there might be a reason) - I'm trying to implement a 'perfect' wrapper around C++ integer ...
0
votes
1
answer
59
views
Property "shape" not accessible when using generics with toZod
TL;DR I have a type error here is the TS PLAYGROUND
I want to have type safety when creating my zod schemas.
To do so, I use the type of my data, like this one:
type Option = { id: number };
With ...
0
votes
1
answer
121
views
Convert string to Int in DataSet
Sorting does not work in dataGridView1 because when reading from XML the data is read in string format. (Instead of 13-4-3-3-2 I get 13-2-3-3-4)
DataXML = new DataSet();
FileStream fs = new ...
0
votes
0
answers
26
views
Handy DataRow.Field<> version - with null checking
I'm using c# to get data from DB. I know there is as Field<> extenstion to DataRow:
public static T? Field<T>(this DataRow row, string columnName)
But, I'd like to have a method that is ...
0
votes
1
answer
54
views
Why can't a generic factory redirect to a specific subclass?
Below is some code that (currently) doesn't compile:
sealed class MyValue<ValueT> {
final ValueT value;
const MyValue(this.value);
const factory MyValue.bool(bool value) = MyBool;
...
0
votes
0
answers
41
views
TypeScript Error: 'children' not assignable to type 'IntrinsicAttributes' - React Component Issue
Through error message "Property 'children' does not exist on type 'IntrinsicAttributes'" typically arises in React components when JSX elements receive props that aren't recognized or ...
0
votes
0
answers
25
views
possible lossy conversion from int to short but I have no int variable
I was writing a code to print out the reverse of the 4-digit numbers, so my maximum number is 9999 and below 32767(maximum value of short) . The code is :
public class Project2{
public static void ...
0
votes
1
answer
91
views
Extract string literal type of an interface's function's arguments
In @types/phantom, there is a WebPage interface, which includes the following function:
interface WebPage {
// ...
property(
key:
| "content"
| "...
0
votes
0
answers
535
views
How does one programatically map object values in Zod?
For the following schema:
const z_BaseCustomer = z.object({
name: z.string(),
age: z.number()
});
const pizzas = [
{
value: "pn_pizza",
label: "Pineapple Pizza",
},...
2
votes
1
answer
40
views
Type narrowing doesn't work when a record defined with rest field
import ballerina/io;
type Vehicle record {|
string mode;
string color;
string make;
string ...; // rest field
|};
type AeroPlance record {|
*Vehicle;
string noOfEngines;
|};
...
3
votes
1
answer
78
views
Are comparisons really allowed to return numbers instead of booleans, and why?
I've found a surprising sentence in the Python documentation under Truth Value Testing:
Operations and built-in functions that have a Boolean result always return 0 or False for false and 1 or True ...
0
votes
0
answers
21
views
Return value depends on argument typescript
type options<T extends ZodRawShape> = {
query?:
| string
| URLSearchParams
| Record<string, string>
| string[][]
| undefined;
method?: "GET" ...
0
votes
0
answers
11
views
convert HOC data to time series in python
I have data in HOC format..
Input :
SID Start Date End Date Ratio ABC
1 1-Jan-22 31-Mar-22 1.111
2 1-Feb-22 31-Mar-22 2.222
I am looking for the output :
SID as_of_date Ratio ABC
1 ...
2
votes
1
answer
74
views
How do I use template parameters with "if" and "switch" statements?
I am currently writing a game engine in C++ with Vulkan and right now I am working on boiling down my spaghetti code into something more intuitive. As part of this process, I generalized a descriptor ...
0
votes
1
answer
92
views
How to Save List<List<Bitmap>> to Room Database?
How to save List<List<Bitmap>> to room database? Want to save List<List<Bitmap>> to room database, but it gives error:
Cannot figure out how to save this field into database. ...