Skip to content

Commit

Permalink
[packages] Add @deprecated annotations to deprecated APIs (expo#9959)
Browse files Browse the repository at this point in the history
# Why

_This follows the TS 4.0 update PR: #9960_

Typescript 4.0 comes with support for `@deprecated` annotations, which gives nice VS Code (and probably other IDE) messages informing users about API deprecation. It also marks deprecated methods/properties with ~~Strikethrough~~.

See [this](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#deprecated-support) and microsoft/TypeScript#38523

# How

- Added appropriate annotations to every possible deprecated Expo API that I found.
- Updated existing comments to play nice with VS Code messages

Also, added note about dead code in Notifications, which is related to expo#9563 (I forgot to add it then)

> Not sure what to do with changelogs ❓ 

# Test Plan

Tested messages in VS Code with _TS 4.0.2_ enabled.
  • Loading branch information
barthap committed Sep 1, 2020
1 parent 7237c28 commit 8216412
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions build/Audio/Recording.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export declare class Recording {
pauseAsync(): Promise<RecordingStatus>;
stopAndUnloadAsync(): Promise<RecordingStatus>;
getURI(): string | null;
/** @deprecated Use `createNewLoadedSoundAsync()` instead */
createNewLoadedSound(initialStatus?: AVPlaybackStatusToSet, onPlaybackStatusUpdate?: ((status: AVPlaybackStatus) => void) | null): Promise<{
sound: Sound;
status: AVPlaybackStatus;
Expand Down
1 change: 1 addition & 0 deletions build/Audio/Recording.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/Audio/Recording.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/Audio/Sound.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare class Sound implements Playback {
_eventEmitter: EventEmitter;
_coalesceStatusUpdatesInMillis: number;
_onPlaybackStatusUpdate: ((status: AVPlaybackStatus) => void) | null;
/** @deprecated Use `Sound.createAsync()` instead */
static create: (source: AVPlaybackSource, initialStatus?: AVPlaybackStatusToSet, onPlaybackStatusUpdate?: ((status: AVPlaybackStatus) => void) | null, downloadFirst?: boolean) => Promise<{
sound: Sound;
status: AVPlaybackStatus;
Expand Down
1 change: 1 addition & 0 deletions build/Audio/Sound.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/Audio/Sound.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Audio/Recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export class Recording {
return this._uri;
}

/** @deprecated Use `createNewLoadedSoundAsync()` instead */
async createNewLoadedSound(
initialStatus: AVPlaybackStatusToSet = {},
onPlaybackStatusUpdate: ((status: AVPlaybackStatus) => void) | null = null
Expand Down
1 change: 1 addition & 0 deletions src/Audio/Sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class Sound implements Playback {
_coalesceStatusUpdatesInMillis: number = 100;
_onPlaybackStatusUpdate: ((status: AVPlaybackStatus) => void) | null = null;

/** @deprecated Use `Sound.createAsync()` instead */
static create = async (
source: AVPlaybackSource,
initialStatus: AVPlaybackStatusToSet = {},
Expand Down

0 comments on commit 8216412

Please sign in to comment.