Skip to content

Commit

Permalink
Add Perfect Typescript Intellisense
Browse files Browse the repository at this point in the history
  • Loading branch information
hmmhmmhm committed Dec 22, 2019
1 parent 6afd11d commit 55c4b18
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 48 deletions.
71 changes: 71 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 30,7 @@
"postcss-load-config": "^2.1.0",
"public-ip": "^4.0.0",
"regenerator-runtime": "^0.13.3",
"src": "^1.1.2",
"svelma": "^0.3.0",
"svelte": "^3.16.5",
"svelte-css-in-js": "^1.0.1",
Expand All @@ -48,6 49,7 @@
"@pyoner/svelte-ts-preprocess": "^1.2.1",
"@types/express": "^4.17.2",
"@types/node": "^12.12.21",
"parcel-plugin-typescript-paths": "^0.1.14",
"prettier": "^1.19.1",
"prettier-plugin-svelte": "^0.7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/sample.svelte
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
<script>
<script lang="typescript">
import * as svelte from 'svelte'
import { makeCSS } from 'svelte-css-in-js'
Expand Down
21 changes: 12 additions & 9 deletions src/pages/sample/index.svelte
Original file line number Diff line number Diff line change
@@ -1,9 1,10 @@
<script>
<script lang="typescript">
// Page Query String
export let params = {}
export let params: any = {}
// Component Declaration
// @ts-ignore
import Page from './index.ts'
const { Components, Resources, Router, Store } = Page
Expand All @@ -14,9 15,16 @@
params
)
// Test Intellisense.
// @ts-ignore
import { canYouSeeMe2 } from './'
canYouSeeMe2(123)
// Page Direct Declaration
import { fly } from 'svelte/transition'
import Sample from '../../components/sample'
// @ts-ignore
import Sample from '../../components/sample.svelte'
</script>

<!-- Page Transition Animation -->
Expand All @@ -30,12 38,7 @@
<!-- Page Define -->

<!-- Component -->
<Sample
a="Svelte"
b="Is"
c="Awesome1"
theme={{ fontSize: '20px' }}
/>
<Sample a="Svelte" b="Is" c="Awesome1" theme={{ fontSize: '20px' }} />

</div>

Expand Down
3 changes: 3 additions & 0 deletions src/pages/sample/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 5,11 @@ import {
Resources,
} from '../../utils'

export const canYouSeeMe2 = (test: number) => 'hi??'

export default {
// Logics
canYouSeeMe2,

// Global Variable
Resources,
Expand Down
25 changes: 0 additions & 25 deletions src/types/svelte.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 1,4 @@
export * from 'svelte-reusable/logics'
export * from '../logics/api'
export * from '../resources'
export const canYouSeeMe = () => 'hi??'
37 changes: 25 additions & 12 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,15 1,28 @@
const { preprocess } = require("@pyoner/svelte-ts-preprocess")
const pyoner = require("@pyoner/svelte-ts-preprocess")
const { scss, postcss } = require('svelte-preprocess')
const autoprefixer = require('autoprefixer')

module.exports = {
preprocess: [
scss(),
postcss({
plugins: [
autoprefixer()
]
}),
preprocess()
]
}
// For svelte-vscode
let configJs = { preprocess: pyoner.preprocess() }

if (process.argv[1].indexOf('--') != -1) {
configJs = {
preprocess: [
scss(),
postcss({
plugins: [
autoprefixer()
]
}),
pyoner.preprocess({compilerOptions: {
"ba123seUrl": ".",
"paths": {
"src/*": [
"src/*"
]
}
}})
]
}
}
module.exports = configJs
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 19,13 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"src/*": [
"src/*"
]
}
},
"include": [
"./src/**/*",
Expand Down

0 comments on commit 55c4b18

Please sign in to comment.