Hello all,
Starting with Premiere Beta 27.1.0 build 29, we will be introducing a change for classes which do not have documented constructors where attempting to directly construct these classes using new will now result in a TypeError being thrown. The intent here is to avoid some circumstances where attempting to use these constructors causes errors or other adverse behavior within a plugin and/or Premiere itself.
As an example, the Project class does not explicitly document any constructor use, as Project instances should be returned from one of the various factory functions available instead. Starting with 27.1.0 build 29, attempting to directly construct a Project instance will throw:
const ppro = require("premierepro");
let project = new ppro.Project(); // Uncaught TypeError: Illegal constructor
// Attempting without the `new` keyword will also result in an error
project = ppro.Project(); // Uncaught TypeError: Illegal constructor
Other classes such as Guid, TickTime, or Color have documented constructors and are unaffected by this change (you can view the full list of documented classes with constructors in our 26.5 Changelog entry):
let guid = new ppro.Guid(); // returns a Guid instance
let tickTime = new ppro.TickTime(); // returns a TickTime instance
let color = new ppro.Color(0.3, 0.2, 0.5, 1.0); // returns a Color instance
console.log(color.red); // 0.3
This behavior will extend into any future classes added unless documented otherwise. If you have any questions or run into unexpected errors as a result please let us know!