typeEq
이 페이지에서

typeEq()

함수, 타입 분류

Structural equality for ShaderType: two types are equal when their typeKey strings match, so a constant like boolT compares equal to a freshly built { kind: 'scalar', scalar: 'bool' } object even though they are different references.

import { typeEq } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

function typeEq(a: ShaderType, b: ShaderType): boolean

매개변수

a ShaderType

The first type.

b ShaderType

The second type.

반환값

boolean

true when both spell the same key.

예외

SD0002

This is the check every binary-op, assignment and fn-argument type gate runs before raising SD0002.

설명

Structural equality for ShaderType: two types are equal when their typeKey strings match, so a constant like boolT compares equal to a freshly built { kind: 'scalar', scalar: 'bool' } object even though they are different references. This is the check every binary-op, assignment and fn-argument type gate runs before raising SD0002 (“type mismatch”). Compare two ShaderTypes with this function: === compares references, and a deep equal is slower for the same answer.

예제

예제

import { typeEq, boolT } from 'typeshade'
typeEq(boolT, { kind: 'scalar', scalar: 'bool' }) // true: same key, different object

함께 보기

소스

src/core/ir/types.ts, 1051행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고