Uploaded image for project: 'Realm Studio'
  1. Realm Studio
  2. RSTUDIO-128

TypeScript refactoring: Components exporting interfaces

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      • [ ] Go through and make sure all components exports their state and props interfaces.
      • [ ] And make sure composite components gets their state and props interfaces defined from the interfaces of the components they wrap.
      • [ ] Also - consider using the .kind on interfaces to determine their type, instead of a "mode" or "type" property:
      > First we declare the interfaces we will union. Each interface has a kind property with a different string literal type. The kind property is called the discriminant or tag. The other properties are specific to each interface. Notice that the interfaces are currently unrelated. Let’s put them into a union:
      > 
      > `type Shape = Square | Rectangle | Circle;`
      > 
      > Now let’s use the discriminated union:
      > 
      > ```
      > function area(s: Shape) {
      >     switch (s.kind) {
      >         case "square": return s.size * s.size;
      >         case "rectangle": return s.height * s.width;
      >         case "circle": return Math.PI * s.radius ** 2;
      >     }
      > }
      > ```
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: