Typing to integer ignored
See original GitHub issueIt seems integer typing is broken currently; the following code (‘foo.ts’)
/**
* @minimum 1
* @TJS-type integer
*/
export type natural = number;
class Foo {
bar: natural;
}
results in the following JSON schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"bar": {
"minimum": 1,
"type": "number"
}
},
"type": "object"
}
bar
should be an integer, but it gets casted to number
.
We’ve confirmed this behaviour happening on multiple systems running MacOS, on different versions of this package.
This was working as intended at least 3 months ago (or so), perhaps sooner.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Python cannot ignore str when input is int() - Stack Overflow
I want the program to ignore any str that it can't convert to an int. I tried declaring a variable that said type(input)....
Read more >Fix text-formatted numbers by applying a number format
On the menu, click Convert to Number. (If you want to simply get rid of the error indicator without converting the number, click...
Read more >Strict mode - Ajv JSON schema validator
Type "number" can be narrowed to "integer", the opposite would violate strictTypes . # Require applicable types. This simple JSON Schema is valid,...
Read more >Ignore Types Or Values — DeepDiff 6.2.2 documentation
Ignore type changes between members of groups of types. For example if you want to ignore type changes between float and decimals etc....
Read more >Common issues and solutions - mypy 0.991 documentation
A # type: ignore comment at the top of a module (before any statements, including imports or docstrings) has the effect of ignoring...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue (but on an interface property). Apparently using
@type
instead of@TJS-type
works with typescript 3.7I used typescript 3.5.3. It does seem that in TypeScript 3.7 the annotations are parsed differently, so the code has to be updated. I opened a PR for that.