jkcfg / kubernetes

Apache License 2.0
26 stars 6 forks source link

Reform TypeScript API #65

Closed squaremo closed 4 years ago

squaremo commented 4 years ago

The constructors for classes in module api have the following problem: they have all optional fields, and accept a desc parameter of the corresponding interface type from shapes -- but the shapes types have required fields, so you can't supply a value constructed from an api class.

Assuming the intention is to let people call constructors with plain objects, like this:

const roleBinding = new api.rbac.v1.RoleBinding('foo', {
  roleRef: { name: 'bar' },
});

.. then there's no need for interfaces, since the class is the correct type already. So: