Skip to content

Commit 65fdcc6

Browse files
committed
update typescript
1 parent 2bb4027 commit 65fdcc6

56 files changed

Lines changed: 134 additions & 139 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/codingcatdev/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@tailwindcss/typography": "^0.5.9",
2323
"@types/marked": "^4.0.8",
2424
"@types/prismjs": "^1.26.0",
25+
"@types/video.js": "^7.3.51",
2526
"autoprefixer": "^10.4.13",
2627
"daisyui": "^2.51.2",
2728
"eslint": "^8.35.0",
File renamed without changes.

apps/codingcatdev/src/lib/components/content/CloudinaryImage.svelte

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
<script>
2-
/** @type {string} */
3-
export let src;
4-
5-
/** @type {string} */
6-
export let alt;
7-
8-
/** @type {string=} */
9-
export let classes;
1+
<script lang="ts">
2+
export let src: string;
3+
export let alt: string;
4+
export let classes: string;
105
116
import { lazyload, HtmlImageLayer } from '@cloudinary/html';
127
import { CloudinaryImage } from '@cloudinary/url-gen';
138
import { format, quality } from '@cloudinary/url-gen/actions/delivery';
149
import { auto } from '@cloudinary/url-gen/qualifiers/format';
1510
import { onMount } from 'svelte';
1611
17-
/** @type {HTMLImageElement| null}*/
18-
let bindImage = null;
12+
let bindImage: HTMLImageElement | null = null;
1913
onMount(() => {
2014
const newImage = new CloudinaryImage(
2115
src.match(/upload\/(?:v\d+\/)?(.+?)\.[^\.]+$/)?.at(1),

apps/codingcatdev/src/lib/components/content/Content.svelte

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
<script>
1+
<script lang="ts">
22
import 'prism-themes/themes/prism-shades-of-purple.min.css';
33
import RecentPostsList from '$lib/components/content/RecentPostsList.svelte';
44
import LessonList from '$lib/components/content/LessonList.svelte';
5-
import { ContentType } from '$lib/types/index';
5+
import {
6+
ContentType,
7+
type Content,
8+
type Course,
9+
type Lesson,
10+
type Podcast
11+
} from '$lib/types/index';
612
import Video from '$lib/components/content/Video.svelte';
7-
/** @typedef {import('$lib/types/index').Content} Content */
8-
/** @typedef {import('$lib/types/index').ContentList} ContentList */
9-
10-
/**@type {{contentType: string, content: Content | null, course: ContentList, tutorial: ContentList, podcast: ContentList, post: ContentList}}*/
11-
export let data;
13+
export let data: {
14+
content: Lesson;
15+
course: Course[];
16+
tutorial: Content[];
17+
podcast: Podcast[];
18+
post: Content[];
19+
};
1220
</script>
1321

1422
{#if data?.content}

apps/codingcatdev/src/lib/components/content/ContentCards.svelte

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
<script>
1+
<script lang="ts">
22
import AJPrimary from '$lib/components/global/icons/AJPrimary.svelte';
33
import Image from '$lib/components/content/Image.svelte';
4+
import type { Content, ContentType } from '$lib/types';
45
5-
/** @type {import('$lib/types/index').ContentType} */
6-
export let type;
7-
8-
/** @typedef {import('$lib/types/index').Content} Content */
9-
10-
/** @type {{content: Content[], next?: any}} */
11-
export let data;
6+
export let type: ContentType;
7+
export let data: { content: Content[]; next?: any };
128
139
let next = data.next;
1410
const more = async () => {

apps/codingcatdev/src/lib/components/content/Image.svelte

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
<script>
1+
<script lang="ts">
22
//TODO: Dynamic import?
33
import CloudinaryImage from '$lib/components/content/CloudinaryImage.svelte';
4-
5-
/** @type {function=} */
6-
export let loader = undefined;
7-
8-
/** @type {string} */
9-
export let src;
10-
11-
/** @type {string} */
12-
export let alt;
13-
14-
/** @type {string=} */
15-
export let classes;
4+
export let loader: undefined | (() => {}) = undefined;
5+
export let src: string;
6+
export let alt: string;
7+
export let classes: string;
168
</script>
179

1810
{#if loader}

apps/codingcatdev/src/lib/components/content/LessonList.svelte

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<script>
2-
/** @type {import('$lib/types/index').Content[]} */
3-
export let lesson;
1+
<script lang="ts">
2+
import type { Content } from '$lib/types';
43
5-
/** @type {string} */
6-
export let courseSlug;
4+
export let lesson: Content[];
5+
export let courseSlug: string;
76
</script>
87

98
<div class="pt-2">

apps/codingcatdev/src/lib/components/content/RecentPostsList.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<script>
2-
/** @type {import('$lib/types/index').Content[]} */
3-
export let list;
4-
/** @type {import('$lib/types/index').ContentType} */
5-
export let contentType;
1+
<script lang="ts">
2+
import type { Content, ContentType } from '$lib/types';
3+
4+
export let list: Content[];
5+
export let contentType: ContentType;
66
</script>
77

88
<div class="pt-2">

apps/codingcatdev/src/lib/components/global/Video.svelte renamed to apps/codingcatdev/src/lib/components/content/Video.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script>
1+
<script lang="ts">
22
import '../../../../node_modules/video.js/dist/video-js.min.css';
33
import videojs from 'video.js';
44
// import 'videojs-youtube';
@@ -7,15 +7,15 @@
77
88
/**
99
* See https://videojs.com/guides/options/#sources
10-
* @type {[{
11-
* src: string
12-
* type: string
13-
* }]}*/
14-
export let sources;
10+
* @type */
11+
export let sources: [
12+
{
13+
src: string;
14+
type: string;
15+
}
16+
];
1517
16-
/** TODO: fix Player definition
17-
* @type any */
18-
let player;
18+
let player: any;
1919
2020
const setPlayer = () => {
2121
player = videojs(

apps/codingcatdev/src/lib/components/global/icons/AJ404.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script>
1+
<script lang="ts">
22
export let cls = 'block w-full h-auto lg:w-1/2';
33
</script>
44

0 commit comments

Comments
 (0)