-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ts-auto-guard to WeatherProvider interface.
- Loading branch information
Showing
5 changed files
with
38 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Generated type guards for "weatherapi.ts". | ||
* WARNING: Do not manually change this file. | ||
*/ | ||
import { WeatherProvider } from './weatherapi' | ||
|
||
export function isWeatherProvider(obj: unknown): obj is WeatherProvider { | ||
const typedObj = obj as WeatherProvider | ||
return ( | ||
((typedObj !== null && typeof typedObj === 'object') || | ||
typeof typedObj === 'function') && | ||
typeof typedObj['name'] === 'string' && | ||
((typedObj['methods'] !== null && | ||
typeof typedObj['methods'] === 'object') || | ||
typeof typedObj['methods'] === 'function') && | ||
(typeof typedObj['methods']['pluginId'] === 'undefined' || | ||
typeof typedObj['methods']['pluginId'] === 'string') && | ||
typeof typedObj['methods']['getData'] === 'function' && | ||
typeof typedObj['methods']['getObservations'] === 'function' && | ||
typeof typedObj['methods']['getForecasts'] === 'function' && | ||
typeof typedObj['methods']['getWarnings'] === 'function' | ||
) | ||
} |
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
67d2209
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the build generates the file anyway I would not add it to git. No biggie, this is also ok if you prefer this way.