ts-validator's People
ts-validator's Issues
is NaN a number?
anonymous types
Search for this issue in code
regex literal
related to #7
Multi variable types
let v1 = { x: 5, y: "6" };
let v2 = { v1 } // or { v: v1 };
validate(v2);
resolve type keywords
Search for this issue
Release process scripts
variables that come from other packages
complex types
https://www.typescriptlang.org/docs/handbook/advanced-types.html
enums,
nested unions 1: x | y | (z | w),
nested unions 2: x | y, where y is (z | w), more parenthesis: (x), ((x)) and & types for all union types
mixed & and | types (where & always has precedence)
string literal types ("val1" | "val2")
number literal
bool literal
enum literals?
access modifiers (public, private, readonly, static)
dictionaries (also readonly dictionaries)
conditional types
Validation result
throw, log, return bool
Also need some details about failure
get type from function return statements
function f() {
if (something) return "something";
return 4;
}
validate(f());
Arrays
Type equality
e.g.
- {x: string} & {y: number} === {x: string, y: number}
- {x: string} | {x: string} === {x: string }
unknown and void keywords
webpack runner
Ids in type map have absolute path
class instanceof
Also config for what to do if constructor is private
config do disable instanceof check
Explicit type validaton
var x: any = { result: "hi" };
type MyType = { result: string };
validate<MyType>(x);
Link validator function to type metadata
Split into different packages
- Core (types, serializer)
- Client (validator)
- Server.Core (code gen, ast traversal, type builder)
- Executor, write to files
Functions as constructors
function Class() {}
const x = new Class();
Tsx
related to #7
Remove calls to getText
variables that come from function args
function (x: MyT) {
validate(x)
}
Don't forget if explicit any compiler arg is on and arg has no type
variables that come from other files
Independant runner
A command line tool that will build validation types
New expression
validate(new Cls())
Search for this issue in code
Full integration tests
Binding patterns
"is" function
function is<T> (subject: any, key?: string): subject is T { ... }
Search for this issue in code
Anonymous type
type T1 = string | {val: string}
Complex type names
var t: tn.X;
var t: tn.["X"];
interface I extends tn.X {}
interface I extends tn["X"] {}
Create validator function
function validate(input: any, type: Type) { }
write file is using Unix path sometimes
Search for this issue number in code
typeof
var o = {d: 5}
validate<typeof o>(null)
read ts compiler config (e.g. strict null checks)
require("...")
projects with no project.json file
Issues with multi declaration of vars
Search for this issue in code
Function types
Find function declaration if function is not simple
Search in code for this issue
obj.f("hi");
, should be able to find string => void
Generic functions
function f<T> (x: T) { validate(x); }
get type from variable without explicit type
var x = 7 ✓
var x = getValue()
var x = {val: 8} ✓
Don't forget if explicit any compiler arg is on and function returns any
Generic types
class Gen<T> {
validate(x: T) => validate(x);
}
Ensure that all file paths are relative to the project root
These paths will be checked into source control, so cannot differ between dev machines
Optional properties
interface I {
val?: string
}
Search for this issue in code
validate function call result
validate(doSomething())
Write type metadata to file
Built in types
Regex
Date
Dom node
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.