mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-25 11:03:07 +00:00
import type syntax
This commit is contained in:
parent
f1ba01f21e
commit
192d9b0c9c
15 changed files with 32 additions and 42 deletions
|
@ -2,7 +2,7 @@
|
|||
* Tone.js
|
||||
* @author Yotam Mann
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @copyright 2014-2019 Yotam Mann
|
||||
* @copyright 2014-2024 Yotam Mann
|
||||
*/
|
||||
import { version } from "../version.js";
|
||||
import { theWindow } from "./context/AudioContext.js";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Seconds, Ticks } from "../type/Units.js";
|
||||
import { noOp } from "../util/Interface.js";
|
||||
|
||||
type Transport = import("../clock/Transport").TransportClass;
|
||||
import type { TransportClass as Transport } from "./Transport.js";
|
||||
|
||||
export interface TransportEventOptions {
|
||||
callback: (time: number) => void;
|
||||
|
|
|
@ -3,8 +3,7 @@ import { TicksClass } from "../type/Ticks.js";
|
|||
import { Seconds, Ticks, Time } from "../type/Units.js";
|
||||
import { TransportEvent, TransportEventOptions } from "./TransportEvent.js";
|
||||
import { GT, LT } from "../util/Math.js";
|
||||
|
||||
type Transport = import("../clock/Transport").TransportClass;
|
||||
import type { TransportClass as Transport } from "./Transport.js";
|
||||
|
||||
interface TransportRepeatEventOptions extends TransportEventOptions {
|
||||
interval: Ticks;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Seconds } from "../type/Units.js";
|
||||
import { Emitter } from "../util/Emitter.js";
|
||||
import { AnyAudioContext } from "./AudioContext.js";
|
||||
|
||||
type Draw = import("../util/Draw").DrawClass;
|
||||
type Destination = import("./Destination").DestinationClass;
|
||||
type Transport = import("../clock/Transport").TransportClass;
|
||||
type Listener = import("./Listener").ListenerClass;
|
||||
import type { DrawClass as Draw } from "../util/Draw.js";
|
||||
import type { DestinationClass as Destination } from "./Destination.js";
|
||||
import type { TransportClass as Transport } from "../clock/Transport.js";
|
||||
import type { ListenerClass as Listener } from "./Listener.js";
|
||||
|
||||
// these are either not used in Tone.js or deprecated and not implemented.
|
||||
export type ExcludedFromBaseAudioContext =
|
||||
|
|
|
@ -12,11 +12,10 @@ import {
|
|||
import { closeContext, initializeContext } from "./ContextInitialization.js";
|
||||
import { BaseContext, ContextLatencyHint } from "./BaseContext.js";
|
||||
import { assert } from "../util/Debug.js";
|
||||
|
||||
type Transport = import("../clock/Transport").TransportClass;
|
||||
type Destination = import("./Destination").DestinationClass;
|
||||
type Listener = import("./Listener").ListenerClass;
|
||||
type Draw = import("../util/Draw").DrawClass;
|
||||
import type { DrawClass as Draw } from "../util/Draw.js";
|
||||
import type { DestinationClass as Destination } from "./Destination.js";
|
||||
import type { TransportClass as Transport } from "../clock/Transport.js";
|
||||
import type { ListenerClass as Listener } from "./Listener.js";
|
||||
|
||||
export interface ContextOptions {
|
||||
clockSource: TickerClockSource;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
//-------------------------------------
|
||||
// INITIALIZING NEW CONTEXT
|
||||
//-------------------------------------
|
||||
|
||||
type Context = import("./Context").Context;
|
||||
import type { Context } from "./Context.js";
|
||||
|
||||
/**
|
||||
* Array of callbacks to invoke when a new context is created
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { BaseContext } from "./BaseContext.js";
|
||||
import { Seconds } from "../type/Units.js";
|
||||
import { AnyAudioContext } from "./AudioContext.js";
|
||||
|
||||
type Draw = import("../util/Draw").DrawClass;
|
||||
type Destination = import("./Destination").DestinationClass;
|
||||
type Transport = import("../clock/Transport").TransportClass;
|
||||
type Listener = import("./Listener").ListenerClass;
|
||||
import type { DrawClass as Draw } from "../util/Draw.js";
|
||||
import type { DestinationClass as Destination } from "./Destination.js";
|
||||
import type { TransportClass as Transport } from "../clock/Transport.js";
|
||||
import type { ListenerClass as Listener } from "./Listener.js";
|
||||
|
||||
export class DummyContext extends BaseContext {
|
||||
//---------------------------
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
isUndef,
|
||||
} from "../util/TypeCheck.js";
|
||||
import { BaseContext } from "./BaseContext.js";
|
||||
import type { TransportClass } from "../clock/Transport";
|
||||
import type { TransportClass } from "../clock/Transport.js";
|
||||
|
||||
/**
|
||||
* A unit which process audio
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import { isUndef } from "./TypeCheck.js";
|
||||
import type { BaseContext } from "../context/BaseContext.js";
|
||||
import type { Time } from "../type/Units.js";
|
||||
|
||||
/**
|
||||
* Assert that the statement is true, otherwise invoke the error.
|
||||
|
@ -25,9 +27,7 @@ export function assertRange(value: number, gte: number, lte = Infinity): void {
|
|||
/**
|
||||
* Warn if the context is not running.
|
||||
*/
|
||||
export function assertContextRunning(
|
||||
context: import("../context/BaseContext").BaseContext
|
||||
): void {
|
||||
export function assertContextRunning(context: BaseContext): void {
|
||||
// add a warning if the context is not started
|
||||
if (!context.isOffline && context.state !== "running") {
|
||||
warn(
|
||||
|
@ -52,9 +52,7 @@ export function enterScheduledCallback(insideCallback: boolean): void {
|
|||
/**
|
||||
* Make sure that a time was passed into
|
||||
*/
|
||||
export function assertUsedScheduleTime(
|
||||
time?: import("../type/Units").Time
|
||||
): void {
|
||||
export function assertUsedScheduleTime(time?: Time): void {
|
||||
if (
|
||||
isUndef(time) &&
|
||||
isInsideScheduledCallback &&
|
||||
|
|
|
@ -4,8 +4,7 @@ import {
|
|||
isAudioParam,
|
||||
} from "./AdvancedTypeCheck.js";
|
||||
import { isDefined, isObject, isUndef } from "./TypeCheck.js";
|
||||
|
||||
type BaseToneOptions = import("../Tone").BaseToneOptions;
|
||||
import type { BaseToneOptions } from "../Tone.js";
|
||||
|
||||
/**
|
||||
* Some objects should not be merged
|
||||
|
|
|
@ -7,10 +7,10 @@ import { ToneAudioBuffer } from "./core/context/ToneAudioBuffer.js";
|
|||
export { start } from "./core/Global.js";
|
||||
import { Seconds } from "./core/type/Units.js";
|
||||
export { supported } from "./core/context/AudioContext.js";
|
||||
import type { TransportClass } from "./core/clock/Transport";
|
||||
import type { DestinationClass } from "./core/context/Destination";
|
||||
import type { DrawClass } from "./core/util/Draw";
|
||||
import type { ListenerClass } from "./core/context/Listener";
|
||||
import type { TransportClass } from "./core/clock/Transport.js";
|
||||
import type { DestinationClass } from "./core/context/Destination.js";
|
||||
import type { DrawClass } from "./core/util/Draw.js";
|
||||
import type { ListenerClass } from "./core/context/Listener.js";
|
||||
|
||||
/**
|
||||
* The current audio context time of the global {@link BaseContext}.
|
||||
|
|
|
@ -11,7 +11,7 @@ import { optionsFromArguments } from "../core/util/Defaults.js";
|
|||
import { TransportTimeClass } from "../core/type/TransportTime.js";
|
||||
import { ToneConstantSource } from "./ToneConstantSource.js";
|
||||
import { OutputNode } from "../core/context/ToneAudioNode.js";
|
||||
import type { TransportClass } from "../core/clock/Transport";
|
||||
import type { TransportClass } from "../core/clock/Transport.js";
|
||||
|
||||
/**
|
||||
* Adds the ability to synchronize the signal to the {@link TransportClass}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { analyze } from "./Spectrum.js";
|
||||
import { TestAudioBuffer } from "./TestAudioBuffer.js";
|
||||
import type { ToneAudioBuffer } from "../../../Tone/core/context/ToneAudioBuffer";
|
||||
import type { ToneAudioBuffer } from "../../../Tone/core/context/ToneAudioBuffer.js";
|
||||
import plotly from "plotly.js-dist";
|
||||
import array2d from "array2d";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import toWav from "audiobuffer-to-wav";
|
||||
import type { ToneAudioBuffer } from "../../../Tone/core/context/ToneAudioBuffer";
|
||||
import type { ToneAudioBuffer } from "../../../Tone/core/context/ToneAudioBuffer.js";
|
||||
|
||||
export class TestAudioBuffer {
|
||||
static async fromUrl(
|
||||
|
|
|
@ -3,23 +3,22 @@
|
|||
"compilerOptions": {
|
||||
"strictNullChecks": true,
|
||||
"target": "ES6",
|
||||
"module": "ES2015",
|
||||
"module": "Node16",
|
||||
"noImplicitAny": false,
|
||||
"importHelpers": true,
|
||||
"noUnusedLocals": false,
|
||||
"removeComments": false,
|
||||
"outDir": "./build/esm",
|
||||
"verbatimModuleSyntax" : false,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "Bundler",
|
||||
"moduleResolution": "Node16",
|
||||
"strictPropertyInitialization": true,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es6", "dom", "es2015"],
|
||||
"baseUrl": "./",
|
||||
"rootDir": "./",
|
||||
"rootDir": "./"
|
||||
},
|
||||
"include": ["Tone/**/*.ts", "test/**/*.ts"],
|
||||
"exclude": ["node_modules", "test/integration/**"]
|
||||
|
|
Loading…
Reference in a new issue