Browse Source

fix the last of the type annotations (still have to fix no-explicit-any warnings)

kb/add-usage-guide
Trent Larson 1 year ago
parent
commit
a5e0c847b1
  1. 703
      package-lock.json
  2. 1
      package.json
  3. 121
      sample.txt
  4. 4
      src/libs/endorserServer.ts
  5. 8
      src/views/ContactGiftingView.vue
  6. 8
      src/views/DiscoverView.vue
  7. 5
      src/views/HomeView.vue
  8. 7
      src/views/NewEditProjectView.vue
  9. 1
      tsconfig.json

703
package-lock.json

File diff suppressed because it is too large

1
package.json

@ -56,6 +56,7 @@
"web-did-resolver": "^2.0.27" "web-did-resolver": "^2.0.27"
}, },
"devDependencies": { "devDependencies": {
"@types/leaflet": "^1.9.4",
"@types/ramda": "^0.29.3", "@types/ramda": "^0.29.3",
"@types/three": "^0.152.1", "@types/three": "^0.152.1",
"@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/eslint-plugin": "^5.61.0",

121
sample.txt

@ -1,121 +0,0 @@
> kickstart-for-time-pwa@0.1.0 build
> vue-cli-service build
All browser targets in the browserslist configuration have supported ES module.
Therefore we don't build two separate bundles for differential loading.
ERROR Failed to compile with 10 errors8:42:51 PM
error in src/views/ContactGiftingView.vue:164:13
TS18046: 'err' is of type 'unknown'.
162 | title: "Error",
163 | text:
> 164 | err.message ||
| ^^^
165 | "There was an error retrieving the latest sweet, sweet action.",
166 | },
167 | -1,
error in src/views/ContactGiftingView.vue:173:5
TS2571: Object is of type 'unknown'.
171 |
172 | openDialog(giver: GiverInputInfo) {
> 173 | this.$refs.customDialog.open(giver);
| ^^^^^^^^^^^^^^^^^^^^^^^
174 | }
175 |
176 | handleDialogResult(result: GiverOutputInfo) {
error in src/views/ContactGiftingView.vue:287:19
TS2339: Property 'error' does not exist on type 'CreateAndSubmitGiveResult'.
Property 'error' does not exist on type 'SuccessResult'.
285 |
286 | getGiveCreationErrorMessage(result: CreateAndSubmitGiveResult) {
> 287 | return result.error?.userMessage;
| ^^^^^
288 | }
289 |
290 | getGiveErrorMessage(error: any) {
error in src/views/DiscoverView.vue:347:17
TS18046: 'e' is of type 'unknown'.
345 | type: "danger",
346 | title: "Error",
> 347 | text: e.userMessage || "There was a problem retrieving projects.",
| ^
348 | },
349 | -1,
350 | );
error in src/views/DiscoverView.vue:425:17
TS18046: 'e' is of type 'unknown'.
423 | type: "danger",
424 | title: "Error",
> 425 | text: e.userMessage || "There was a problem retrieving projects.",
| ^
426 | },
427 | -1,
428 | );
error in src/views/DiscoverView.vue:461:15
TS7006: Parameter 'event' implicitly has an 'any' type.
459 | }
460 |
> 461 | setMapPoint(event) {
| ^^^^^
462 | if (this.isNewMarkerSet) {
463 | this.localLatDiff = Math.abs(event.latlng.lat - this.localCenterLat);
464 | this.localLongDiff = Math.abs(event.latlng.lng - this.localCenterLong);
error in src/views/HelpView.vue:182:26
TS2732: Cannot find module '../../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
180 |
181 | <script lang="ts">
> 182 | import * as Package from "../../package.json";
| ^^^^^^^^^^^^^^^^^^^^
183 | import { Component, Vue } from "vue-facing-decorator";
184 | import QuickNav from "@/components/QuickNav.vue";
185 |
error in src/views/HomeView.vue:295:13
TS18046: 'err' is of type 'unknown'.
293 | title: "Error",
294 | text:
> 295 | err.userMessage ||
| ^^^
296 | "There was an error retrieving the latest sweet, sweet action.",
297 | },
298 | -1,
error in src/views/HomeView.vue:428:5
TS2571: Object is of type 'unknown'.
426 |
427 | openDialog(giver: GiverInputInfo) {
> 428 | this.$refs.customDialog.open(giver);
| ^^^^^^^^^^^^^^^^^^^^^^^
429 | }
430 |
431 | handleDialogResult(result: GiverOutputInfo) {
error in src/views/NewEditProjectView.vue:286:20
TS2339: Property '$router' does not exist on type 'Vue'.
284 | name: "project",
285 | };
> 286 | that.$router.push(route);
| ^^^^^^^
287 | },
288 | 2000,
289 | this,

4
src/libs/endorserServer.ts

@ -112,12 +112,12 @@ export function didInfo(
} }
} }
interface SuccessResult { export interface SuccessResult {
type: "success"; type: "success";
response: AxiosResponse<ClaimResult>; response: AxiosResponse<ClaimResult>;
} }
interface ErrorResult { export interface ErrorResult {
type: "error"; type: "error";
error: InternalError; error: InternalError;
} }

8
src/views/ContactGiftingView.vue

@ -89,6 +89,7 @@ import { accessToken } from "@/libs/crypto";
import { import {
createAndSubmitGive, createAndSubmitGive,
CreateAndSubmitGiveResult, CreateAndSubmitGiveResult,
ErrorResult,
GiverInputInfo, GiverInputInfo,
GiverOutputInfo, GiverOutputInfo,
} from "@/libs/endorserServer"; } from "@/libs/endorserServer";
@ -96,7 +97,6 @@ import { Contact } from "@/db/tables/contacts";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue"; import EntityIcon from "@/components/EntityIcon.vue";
import { IIdentifier } from "@veramo/core"; import { IIdentifier } from "@veramo/core";
import { RawAxiosRequestHeaders } from "axios";
interface Notification { interface Notification {
group: string; group: string;
@ -154,7 +154,7 @@ export default class HomeView extends Vue {
this.apiServer = settings?.apiServer || ""; this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || ""; this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray(); this.allContacts = await db.contacts.toArray();
} catch (err: unknown) { } catch (err: any) {
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
@ -170,7 +170,7 @@ export default class HomeView extends Vue {
} }
openDialog(giver: GiverInputInfo) { openDialog(giver: GiverInputInfo) {
this.$refs.customDialog.open(giver); (this.$refs.customDialog as GiftedDialog).open(giver);
} }
handleDialogResult(result: GiverOutputInfo) { handleDialogResult(result: GiverOutputInfo) {
@ -284,7 +284,7 @@ export default class HomeView extends Vue {
} }
getGiveCreationErrorMessage(result: CreateAndSubmitGiveResult) { getGiveCreationErrorMessage(result: CreateAndSubmitGiveResult) {
return result.error?.userMessage; return (result as ErrorResult).error?.userMessage;
} }
getGiveErrorMessage(error: any) { getGiveErrorMessage(error: any) {

8
src/views/DiscoverView.vue

@ -185,6 +185,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { LeafletMouseEvent } from "leaflet";
import "leaflet/dist/leaflet.css"; import "leaflet/dist/leaflet.css";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { import {
@ -202,7 +203,6 @@ import { didInfo, ProjectData } from "@/libs/endorserServer";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import InfiniteScroll from "@/components/InfiniteScroll.vue"; import InfiniteScroll from "@/components/InfiniteScroll.vue";
import EntityIcon from "@/components/EntityIcon.vue"; import EntityIcon from "@/components/EntityIcon.vue";
import { RawAxiosRequestHeaders } from "axios";
const DEFAULT_LAT_LONG_DIFF = 0.01; const DEFAULT_LAT_LONG_DIFF = 0.01;
const WORLD_ZOOM = 2; const WORLD_ZOOM = 2;
@ -337,7 +337,7 @@ export default class DiscoverView extends Vue {
} else { } else {
throw JSON.stringify(results); throw JSON.stringify(results);
} }
} catch (e) { } catch (e: any) {
console.log("Error with feed load:", e); console.log("Error with feed load:", e);
this.$notify( this.$notify(
{ {
@ -415,7 +415,7 @@ export default class DiscoverView extends Vue {
} else { } else {
throw JSON.stringify(results); throw JSON.stringify(results);
} }
} catch (e) { } catch (e: any) {
console.log("Error with feed load:", e); console.log("Error with feed load:", e);
this.$notify( this.$notify(
{ {
@ -458,7 +458,7 @@ export default class DiscoverView extends Vue {
this.$router.push(route); this.$router.push(route);
} }
setMapPoint(event) { setMapPoint(event: LeafletMouseEvent) {
if (this.isNewMarkerSet) { if (this.isNewMarkerSet) {
this.localLatDiff = Math.abs(event.latlng.lat - this.localCenterLat); this.localLatDiff = Math.abs(event.latlng.lat - this.localCenterLat);
this.localLongDiff = Math.abs(event.latlng.lng - this.localCenterLong); this.localLongDiff = Math.abs(event.latlng.lng - this.localCenterLong);

5
src/views/HomeView.vue

@ -216,7 +216,6 @@ import { Contact } from "@/db/tables/contacts";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue"; import EntityIcon from "@/components/EntityIcon.vue";
import { IIdentifier } from "@veramo/core"; import { IIdentifier } from "@veramo/core";
import { RawAxiosRequestHeaders } from "axios";
interface Notification { interface Notification {
group: string; group: string;
@ -285,7 +284,7 @@ export default class HomeView extends Vue {
this.allContacts = await db.contacts.toArray(); this.allContacts = await db.contacts.toArray();
this.feedLastViewedId = settings?.lastViewedClaimId; this.feedLastViewedId = settings?.lastViewedClaimId;
this.updateAllFeed(); this.updateAllFeed();
} catch (err) { } catch (err: any) {
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
@ -425,7 +424,7 @@ export default class HomeView extends Vue {
} }
openDialog(giver: GiverInputInfo) { openDialog(giver: GiverInputInfo) {
this.$refs.customDialog.open(giver); (this.$refs.customDialog as GiftedDialog).open(giver);
} }
handleDialogResult(result: GiverOutputInfo) { handleDialogResult(result: GiverOutputInfo) {

7
src/views/NewEditProjectView.vue

@ -279,11 +279,8 @@ export default class NewEditProjectView extends Vue {
resp.data.success.handleId || resp.data.success.fullIri, resp.data.success.handleId || resp.data.success.fullIri,
); );
setTimeout( setTimeout(
function (that: Vue) { function (that: NewEditProjectView) {
const route = { that.$router.push({ name: "project" });
name: "project",
};
that.$router.push(route);
}, },
2000, 2000,
this, this,

1
tsconfig.json

@ -1,6 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"resolveJsonModule": true,
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"strict": true, "strict": true,

Loading…
Cancel
Save