File tree Expand file tree Collapse file tree
api/writer-generator/typescript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ const generateProfileHelpersImport = (
236236 const canonicalUrl = snapshot . identifier . url ;
237237
238238 const imports : string [ ] = [ ] ;
239- if ( snapshot . base . name === "Extension" && ! ! canonicalUrl && collectSubExtensionSlices ( snapshot ) . length > 0 )
239+ if ( snapshot . base . name === "Extension" && canonicalUrl && collectSubExtensionSlices ( snapshot ) . length > 0 )
240240 imports . push ( "isRawExtensionInput" ) ;
241241 if ( canonicalUrl && hasMeta ) imports . push ( "ensureProfile" ) ;
242242 if ( sliceDefs . length > 0 || factoryInfo . sliceAutoFields . length > 0 )
Original file line number Diff line number Diff line change @@ -147,6 +147,10 @@ export const isProfileIdentifier = (id: TypeIdentifier | undefined): id is Profi
147147 return id ?. kind === "profile" ;
148148} ;
149149
150+ export const isSnapshotProfileIdentifier = ( id : TypeIdentifier | undefined ) : id is SnapshotProfileIdentifier => {
151+ return id ?. kind === "profile-snapshot" ;
152+ } ;
153+
150154export const isSpecializationIdentifier = (
151155 id : TypeIdentifier | undefined ,
152156) : id is ResourceIdentifier | ComplexTypeIdentifier | LogicalIdentifier => {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 isProfileTypeSchema ,
2424 isResourceIdentifier ,
2525 isResourceTypeSchema ,
26+ isSnapshotProfileIdentifier ,
2627 isSnapshotProfileTypeSchema ,
2728 isSpecializationTypeSchema ,
2829 type LogicalTypeSchema ,
@@ -371,12 +372,12 @@ export const mkTypeSchemaIndex = (
371372 populateTypeFamily ( schemas ) ;
372373
373374 const resolve = ( id : Identifier ) : TypeSchema | undefined => {
374- if ( id . kind === "profile-snapshot" ) return snapshotIndex [ id . url ] ?. [ id . package ] ;
375+ if ( isSnapshotProfileIdentifier ( id ) ) return snapshotIndex [ id . url ] ?. [ id . package ] ;
375376 return index [ id . url ] ?. [ id . package ] ;
376377 } ;
377378 const resolveType = ( id : TypeIdentifier ) : TypeSchema | NestedTypeSchema | undefined => {
378379 if ( isNestedIdentifier ( id ) ) return nestedIndex [ id . url ] ?. [ id . package ] ;
379- if ( id . kind === "profile-snapshot" ) return snapshotIndex [ id . url ] ?. [ id . package ] ;
380+ if ( isSnapshotProfileIdentifier ( id ) ) return snapshotIndex [ id . url ] ?. [ id . package ] ;
380381 return index [ id . url ] ?. [ id . package ] ;
381382 } ;
382383
You can’t perform that action at this time.
0 commit comments