Skip to content
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

テンプレート非同期関数の型情報を追加 #102

Closed
Tracked by #60
qrac opened this issue Nov 13, 2022 · 0 comments
Closed
Tracked by #60

テンプレート非同期関数の型情報を追加 #102

qrac opened this issue Nov 13, 2022 · 0 comments

Comments

@qrac
Copy link
Owner

qrac commented Nov 13, 2022

getStaticDataに型情報がなかったので追加する。

// Function Result Type
import type { StaticData } from "minista"

export async function getStaticData(): Promise<StaticData> {
  const apiUrl = "http://localhost:5174/issues"
  const response = await fetch(apiUrl)

  const data = await response.json()
  return {
    props: {
      issues: data,
    },
  }
}
// Arrow Function Type
import type { GetStaticData } from "minista"

export const getStaticData: GetStaticData = async ()=> {
  const apiUrl = "http://localhost:5174/issues"
  const response = await fetch(apiUrl)

  const data = await response.json()
  return {
    props: {
      issues: data,
    },
  }
}
@qrac qrac mentioned this issue Nov 13, 2022
53 tasks
@qrac qrac changed the title 非同期関数getStaticDataの型情報を追加 テンプレート非同期関数の型情報を追加 Feb 22, 2023
qrac added a commit that referenced this issue Feb 22, 2023
@qrac qrac closed this as completed May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant