Last active
June 3, 2016 19:35
-
-
Save Sequoia/f2e00fafe51764b62bbbf30fc91207fd to your computer and use it in GitHub Desktop.
Why does VS Code not know what properties my SurveyQuestion type has?
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
// in projectroot/types/ | |
interface MapConfig { | |
applicationName: string; | |
schoolName: string; | |
introText : { | |
title: string; | |
body: string; | |
}; | |
redirectURL: string; | |
mapbox: { | |
/** @see https://www.mapbox.com/studio/ to create style */ | |
styleUrl: string; | |
/** @see https://www.mapbox.com/mapbox.js/api/v2.4.0/api-access-tokens/ */ | |
accessToken: string; | |
}; | |
/** @see https://www.mapbox.com/mapbox.js/api/v2.4.0/l-latlngbounds/ */ | |
bounds: MapConfigBounds; | |
types : Array<MapConfigFeature>; | |
} | |
interface MapConfigBounds { | |
southWest : ({ lat: number; lng: number }); | |
northEast : ({ lat: number; lng: number }); | |
} | |
interface MapConfigFeature { | |
/** "bike path", "park" etc. */ | |
name : string; | |
type : 'path' | 'point'; | |
/** hex color */ | |
lineColor: string; | |
description: string; | |
/** Name of icon.png file */ | |
icon: string; | |
} |
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
// in projectroot/types/ | |
interface SurveyQuestion { | |
/** Unique key used to identify the survey question (like an ID) */ | |
key: string; | |
/** Question text */ | |
question: string; | |
options : Array<SurveyOption>; | |
showIf? : SurveyQuestionCondition; | |
} | |
interface SurveyOption { | |
/** Value to be saved / used as key for this answer | |
* Try not to change these!! They are referenced from ShowIf.question properties | |
*/ | |
value : string; | |
/** Label user will see */ | |
label : string; | |
} | |
interface SurveyQuestionCondition { | |
/** Corresponds to a LOWER INDEX (earlier) SurveyQuestion.key */ | |
question : string; | |
/** list of {SurveyOption.value}s for SurveyQuestion specified in this.question | |
* if the answer to the question specified by this.question matches one of the | |
* strings in this.in, the quest this is attached to will be shown | |
*/ | |
in : string[]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment