/three-ts-types

TS type library for the popular webgl library threejs

Primary LanguageTypeScript

This repository is the home for the TypeScript types for three.js. Periodically the updates from this repository are pushed to DefinitelyTyped and released in the @types/three npm package.

We are using this repository as a home for the types instead of DefinitelyTyped because:

  • It is less daunting for users to raise issues or create PRs on a repository that is specific to three.js
  • It is easier to organize the process of making sure we're staying up-to-date with the changes in the three.js repository
  • It gives us more freedom to use our own process

Priorities and goals

The highest priority is making sure that there are no inaccurate types (or types for things that have been removed).

It is a goal to have complete public facing API types for all of the code in the src directory.

It is not a goal for the examples/jsm directory to have complete declaration files for every examples module due to the number of example modules and how quickly they are modified. If you would like to use an examples module that is missing types then create a PR to add the types or create an issue to request that we add the missing types for that module.

Testing

The tests are split into two directories: types/three/test/integration and types/three/test/unit.

Integration tests

The integration tests are usually runnable three.js code that has just been translated to TypeScript to make sure the types work. The three-examples is a special directory that holds the examples from the three.js repository with matching file names. If you want to add a integration test, you can just create a new file in the integration directory.

Unit tests

The unit tests are more fine-grained tests that focus on testing the types for a single file from the source code (either from the three.js core or the JSM addons). The directory structure of the unit tests matches the directory structure of the source code. These tests often contain type assertions as well to test the result of calling a method or to verify that the types produce an error in certain situations.

Contributing

Please see our Contributing Guidelines to help you get started. One of the most important things is choosing a branch to start your work on. If the code you want to contribute is for the current release of three it should be based off master. If it is for the next release of three it should be based off dev. You should then aim your merge into the branch you based off.

Contributors

Thanks goes to these wonderful people (emoji key):

Josh
Josh

πŸ’¬ πŸ› πŸ’» πŸ“– πŸ€” 🚧 πŸ‘€ ⚠️
Nathan Bierema
Nathan Bierema

πŸ’¬ πŸ› πŸ’» πŸ“– πŸ€” πŸš‡ 🚧 πŸ‘€ ⚠️
Michael Herzog
Michael Herzog

πŸ’»
Cody Bennett
Cody Bennett

πŸ’»
0b5vr
0b5vr

πŸ’» ⚠️ 🚧 πŸ‘€ πŸ›
Marquizzo
Marquizzo

πŸ’»
Yuanzk
Yuanzk

πŸ’»
ElisΓ©e Maurer
ElisΓ©e Maurer

πŸ’»
soadzoor
soadzoor

πŸ’»
rinsuki
rinsuki

πŸ’»
efokschaner
efokschaner

πŸ’»
Jonghun Park
Jonghun Park

πŸ’»
sjpt
sjpt

πŸ’»
MichaΕ‚ Mrozek
MichaΕ‚ Mrozek

πŸ’»
puxiao
puxiao

πŸ’»
ycw
ycw

πŸ’»
Jazcash
Jazcash

πŸ’»
Bjorn Stromberg
Bjorn Stromberg

πŸ’»
HappyTurtle
HappyTurtle

πŸ’»
Shuta Hirai
Shuta Hirai

πŸ’»
Servin Nissen
Servin Nissen

πŸ’»
Ben "Pig" Chu
Ben "Pig" Chu

πŸ’»
Makoto Yamada
Makoto Yamada

πŸ’»
schwyzl
schwyzl

πŸ’»
Degubi
Degubi

πŸ’»
Ibby Wedin
Ibby Wedin

πŸ’»
dbuck
dbuck

πŸ’»
Robert Long
Robert Long

πŸ’»
Max Kaye
Max Kaye

πŸ“–
Alejandro Laufer
Alejandro Laufer

πŸ› πŸ’»
Gianmarco
Gianmarco

πŸ’»
David Peicho
David Peicho

πŸ’»
Joe Pea
Joe Pea

πŸ’»
Subhankar Pal
Subhankar Pal

πŸ’»
Sean T. McBeth
Sean T. McBeth

πŸ’»
Arthur LAURENT
Arthur LAURENT

πŸ’»
Serena Li
Serena Li

πŸ’»
cosformula
cosformula

πŸ’»
Peter Hanula
Peter Hanula

πŸ’»
Adam Thompson-Sharpe
Adam Thompson-Sharpe

πŸ’»
noname
noname

πŸ’»
Greg Schafer
Greg Schafer

πŸ’»
SuperSodaSea
SuperSodaSea

πŸ’»
Matt Rossman
Matt Rossman

πŸ’»
Alex Pineda
Alex Pineda

πŸ’»
Lucas
Lucas

πŸ“–
Maciej Ziarkowski
Maciej Ziarkowski

πŸ’»
Suprhimp
Suprhimp

πŸ’»
Stephen Li
Stephen Li

πŸ’»
Moritz Cremer
Moritz Cremer

πŸ’»
LuchoTurtle
LuchoTurtle

πŸ’»
Marcel Wiessler
Marcel Wiessler

πŸ’»
Josh Stern
Josh Stern

πŸ’»
Dan Rose
Dan Rose

πŸ’»
Dan Dolonius
Dan Dolonius

πŸ’»
Benjamin
Benjamin

πŸ’»
Antonio GonzΓ‘lez Viegas
Antonio GonzΓ‘lez Viegas

πŸ’»
Don McCurdy
Don McCurdy

πŸ’»
Xavier Willemin
Xavier Willemin

πŸ’»
zooster
zooster

πŸ’»
Anderson Leite
Anderson Leite

πŸ’»
Guillaume Fradin
Guillaume Fradin

πŸ’»
Heaust Azure
Heaust Azure

πŸ’»
Joe Tipping
Joe Tipping

πŸ’»
Lucas Garron
Lucas Garron

πŸ’»
Marc-Stefan Cassola
Marc-Stefan Cassola

πŸ’»
Piotr BΕ‚aΕΌejewicz (Peter Blazejewicz)
Piotr BΕ‚aΕΌejewicz (Peter Blazejewicz)

πŸ’»
Victoria Shadrina
Victoria Shadrina

πŸ’»
Will Stott
Will Stott

πŸ’»
demike
demike

πŸ’»
Michael γ‚΅γ‚€γƒˆγƒΌ 中村 Bashurov
Michael γ‚΅γ‚€γƒˆγƒΌ 中村 Bashurov

πŸ’»
Jack Bonaguro
Jack Bonaguro

πŸ’»
Rafael Sliveira Cordeiro
Rafael Sliveira Cordeiro

πŸ’» πŸ“–
HEOJUNFO
HEOJUNFO

πŸ’»
Olli Etuaho
Olli Etuaho

πŸ’»
Mathis Brossier
Mathis Brossier

πŸ’»
Ollie Etherington
Ollie Etherington

πŸ’» πŸ›
Mikael Pettersson
Mikael Pettersson

πŸ’»
Tom Harley
Tom Harley

πŸ’»
OndΕ™ej Ε panΔ›l
OndΕ™ej Ε panΔ›l

πŸ› πŸ’» πŸ“– 🚧

FAQ

Why are the declaration files in a types/three/ directory and why is there a notNeededPackages.json?

This makes it easier to re-use the testing process used by DefinitelyTyped since they have a check to make sure the types are within a types directory as well a check for notNeededPackages.json. It also makes it possible to use typeRoots in the tsconfig.json so that the three types can be resolved correctly in the tests.