Open rkosafo opened 7 years ago
Remove "
or '
around them. Instead of foo: "001"
write foo: 001
.
Removing the "
or '
around 001
makes it a float
branchCode: 1 //int
branchCode: 01 //float
branchCode: 001 //float
branchCode: '1' //timespan
branchCode: '01' //timespan
branchCode: '001' //timespan
I have a similar problem.
CustomerId: 66123
I want load it as string. It is always recognized as TimeSpan.
I tried to use:
I was able to read "001" and "66123" as a strings using the constructor with inferTypesFromString set to false:
ValueA: "001"
ValueB: !!str 001
type Configuration = YamlConfig<"configuration.yaml">
// value is loaded as TimeSpan
type Configuration2 = YamlConfig<"configuration.yaml", true, "", false>
// value is loaded as string
The intellisense sometime shows the previous "logic" (TimeSpan) but at runtime it works. Rename the "Configuration" type temporary make it reload the new type and showing the correct type.
Values likes
001
,1234
, etc in my configuration ends up automatically asTimeSpan
. Is there a way to prevent this? I tried quoting them but it made no difference.