-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include type definitions #25
Comments
just worked on a Swift project where i had to define the structure like this. it got me thinking about which entries inside the arrays are allowed to be null/undefined. referring to the 2.0 feature strict null checks. also can relate this to the new 1.2 spec #30 which makes a point that 3 arrays allow null values. here is the swift definition. the way swift works is anything followed by a the entries which allow null are currently: here i have struct FOLD: Decodable {
let vertices_coords: [[Double]]?
let vertices_vertices: [[Int]]?
let vertices_edges: [[Int]]?
let vertices_faces: [[Int?]]?
let edges_vertices: [[Int]]?
let edges_assignment: [String]?
let edges_foldAngle: [Double?]?
let edges_faces: [[Int?]]?
let faces_vertices: [[Int]]?
let faces_edges: [[Int]]?
let faces_faces: [[Int?]]?
let file_frames: [FOLD]?
// metadata
let file_spec: Double?
let file_creator: String?
let file_author: String?
let file_title: String?
let file_description: String?
let file_classes: [String]?
let frame_author: String?
let frame_title: String?
let frame_description: String?
let frame_unit: String?
let frame_classes: [String]?
let frame_attributes: [String]?
} |
This would be really useful. When implementing FOLD in java with just the spec it was sometimes hard to understand what the exact type of a field would be as the spec doesn't differentiate between different kinds of numbers. |
Type definitions for the FOLD library would allow for static type checking as well as intellisense in code editors. This could be accomplished either by providing a
.d.ts
type definition file for the existing code, or by implementing FOLD in TypeScript.The text was updated successfully, but these errors were encountered: