-
Notifications
You must be signed in to change notification settings - Fork 918
docs: add ts demo for extending-a-theme #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import { path } from '@vuepress/utils' | ||
| import { ThemeObject } from '@vuepress/core' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core should put before utils
| import { path } from '@vuepress/utils' | ||
| import { ThemeObject } from '@vuepress/core' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type
| export default { | ||
| // 你的主题 | ||
| name: 'vuepress-theme-foo', | ||
| // 要继承的父主题 | ||
| extends: 'vuepress-theme-bar', | ||
| // 覆盖父主题的布局 | ||
| layouts: { | ||
| Layout: path.resolve(__dirname, 'layouts/Layout.vue'), | ||
| }, | ||
| } as ThemeObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be consistent with the later snippet, i.e. const fooTheme ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
| import type { ThemeObject } from '@vuepress/core' | ||
| import { path } from '@vuepress/utils' | ||
|
|
||
| const fooTheme = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const fooTheme: ThemeObject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I'm sorry for my carelessness.
Perhaps typescript type tip is a better idea to use them as examples in a document.