-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce usage of 'as' statements (#17)
*Issue #, if available:* We use the `as` (e.g. `variableName as varableType`) to tell the TypeScript compiler to trust us that we know a certain variable is a certain type. Example: ``` span.attributes[AWS_ATTRIBUTE_KEYS.AWS_KINESIS_STREAM_NAME] ``` We know that this will be a string, but technically any span attribute value can be of type `string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>` So instead of assuming this is a specific variable type via `as` and ensure it isn't undefined, we should check for the actual type in the above list. *Description of changes:* - Reduce `as` statements - Resolve TypeScript compiler blockers as a result of reducing usage of `as` statements - Use correct `parentSpan instanceof Span` check in `attribute-propagating-span-processor.ts` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
- Loading branch information
Showing
5 changed files
with
43 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters