mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
convert to TS
This commit is contained in:
@@ -195,6 +195,7 @@ Create a basic [Solid](https://www.solidjs.com/) app.
|
|||||||
| [vite:bundler](https://atmospherejs.com/vite/bundler) | | | | | | | | | | | X | X |
|
| [vite:bundler](https://atmospherejs.com/vite/bundler) | | | | | | | | | | | X | X |
|
||||||
| [webapp](https://atmospherejs.com/meteor/webapp) | | | | X | | | | | | | | |
|
| [webapp](https://atmospherejs.com/meteor/webapp) | | | | X | | | | | | | | |
|
||||||
| [zodern:melte](https://atmospherejs.com/zodern/melte) | | | | | | | | X | | | | |
|
| [zodern:melte](https://atmospherejs.com/zodern/melte) | | | | | | | | X | | | | |
|
||||||
|
| [zodern:types](https://atmospherejs.com/zodern/types) | | | | | | | | X | | | | |
|
||||||
|
|
||||||
<h2 id="meteorgenerate"> meteor generate </h2>
|
<h2 id="meteorgenerate"> meteor generate </h2>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import { Mongo } from 'meteor/mongo';
|
|
||||||
|
|
||||||
export const LinksCollection = new Mongo.Collection('links');
|
|
||||||
9
tools/static-assets/skel-svelte/imports/api/links.ts
Normal file
9
tools/static-assets/skel-svelte/imports/api/links.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Mongo } from 'meteor/mongo';
|
||||||
|
|
||||||
|
export interface Link {
|
||||||
|
_id: string;
|
||||||
|
url: string;
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const LinksCollection = new Mongo.Collection<Link>('links');
|
||||||
@@ -1,18 +1,20 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { LinksCollection } from '/imports/api/links';
|
import { Meteor } from "meteor/meteor";
|
||||||
|
import { LinksCollection, type Link } from '../api/links';
|
||||||
|
|
||||||
let counter = 0;
|
let counter: number = 0;
|
||||||
const addToCounter = () => {
|
const addToCounter = (): void => {
|
||||||
counter += 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let subIsReady = false;
|
let subIsReady: boolean = false;
|
||||||
$m: {
|
$m: {
|
||||||
const handle = Meteor.subscribe('links.all');
|
const handle: Meteor.SubscriptionHandle = Meteor.subscribe("links.all");
|
||||||
subIsReady = handle.ready();
|
subIsReady = handle.ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
// more information about $m at https://atmospherejs.com/zodern/melte#tracker-statements
|
// more information about $m at https://atmospherejs.com/zodern/melte#tracker-statements
|
||||||
|
let links: Link[];
|
||||||
$m: links = LinksCollection.find().fetch();
|
$m: links = LinksCollection.find().fetch();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -33,7 +35,4 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<div>Loading ...</div>
|
<div>Loading ...</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<h2>Typescript ready</h2>
|
|
||||||
<p>Just add lang="ts" to .svelte components.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user