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

Custom definitions for AudioAnalyzer. #1180

Merged
merged 5 commits into from
Feb 24, 2024
Merged

Conversation

Neohertz
Copy link
Contributor

Added custom definitions for both GetSpectrum() and Changed.

@@ -868,6 +868,15 @@ interface SocialService extends Instance {
readonly GameInvitePromptClosed: RBXScriptSignal<(senderPlayer: Player, recipientIds: Array<number>) => void>;
}

interface AudioAnalyzer extends Instance {
readonly Changed: RBXScriptSignal<(value: string) => void>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed is actually from Instance.. but we intentionally omit it because it breaks inheritance.

You should try to use .GetPropertyChangedSignal() when possible.

If that doesn't work, there's a helper type called ChangedSignal for this purpose. Here's an example.

Copy link
Member

@osyrisrblx osyrisrblx Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we intentionally omit it because it breaks inheritance

To provide some more context:

  • Instance.Changed is typed as (string) -> void
  • NumberValue.Changed is typed as (number) -> void

These types conflict, so if we add both .Changed events, NumberValue cannot inherit from Instance without an error.

This applies to not just NumberValue, but several different -Value classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha! I'll remove that real quick

Copy link
Member

@osyrisrblx osyrisrblx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to keep the interfaces in customDefinitions.d.ts alphabetically sorted as much as possible. Can you move it higher please?

@osyrisrblx osyrisrblx merged commit 391cbd1 into roblox-ts:master Feb 24, 2024
2 checks passed
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.

2 participants