Skip to content
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

TypeScript Type Declarations Improvements #602

Merged
merged 11 commits into from
Jan 28, 2022
Merged

TypeScript Type Declarations Improvements #602

merged 11 commits into from
Jan 28, 2022

Conversation

jonobr1
Copy link
Owner

@jonobr1 jonobr1 commented Jan 28, 2022

Addresses issue 559 and resolves the following:

  1. Adds extends to all inherited classes
  2. Fixes all constructors to have better code hinting and optionality
  3. Allows for the import via module or through the entire namespace. E.g:
import Two from 'two.js';
import { ZUI } from 'two.js/src/extras/jsm/zui';
import { Circle } from 'two.js/src/shapes/circle';

const two = new Two(); // Hints correctly
const zui = new ZUI(); // Hints correctly

const l1 = two.makeLine(); // Hints correctly
const l2 = new Two.Line(); // Hints correctly
const c = new Circle(); // Hints correctly

Unfortunately, Two.js requires both automated and manual amendments to the types.d.ts files in order to get to the state that it's currently at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant